1 ;; GCC machine description for Matsushita MN10300
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 ;; 2007, 2008 Free Software Foundation, Inc.
4 ;; Contributed by Jeff Law (law@cygnus.com).
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 ;; The original PO technology requires these to be ordered by speed,
23 ;; so that assigner will pick the fastest.
25 ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
27 ;; Condition code settings.
28 ;; none - insn does not affect cc
29 ;; none_0hit - insn does not affect cc but it does modify operand 0
30 ;; This attribute is used to keep track of when operand 0 changes.
31 ;; See the description of NOTICE_UPDATE_CC for more info.
32 ;; set_znv - insn sets z,n,v to usable values; c is unusable.
33 ;; set_zn - insn sets z,n to usable values; v,c are unusable.
34 ;; compare - compare instruction
35 ;; clobber - value of cc is unknown
36 (define_attr "cc" "none,none_0hit,set_znv,set_zn,compare,clobber"
37 (const_string "clobber"))
51 (include "predicates.md")
52 (include "constraints.md")
54 ;; ----------------------------------------------------------------------
56 ;; ----------------------------------------------------------------------
60 (define_expand "movqi"
61 [(set (match_operand:QI 0 "general_operand" "")
62 (match_operand:QI 1 "general_operand" ""))]
66 /* One of the ops has to be in a register */
67 if (!register_operand (operand0, QImode)
68 && !register_operand (operand1, QImode))
69 operands[1] = copy_to_mode_reg (QImode, operand1);
73 [(set (match_operand:QI 0 "nonimmediate_operand" "=d*x*a*f,d*x,d*x*a,d*x*a,m,*f,d*x*a")
74 (match_operand:QI 1 "general_operand" "0,I,d*xai,m,d*xa,d*xa*f,*f"))]
76 && (register_operand (operands[0], QImode)
77 || register_operand (operands[1], QImode))"
80 switch (which_alternative)
87 if (GET_CODE (operands[1]) == CONST_DOUBLE)
90 xoperands[0] = operands[0];
91 xoperands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
92 output_asm_insn (\"mov %1,%0\", xoperands);
96 if (REGNO_REG_CLASS (true_regnum (operands[0])) == EXTENDED_REGS
97 && GET_CODE (operands[1]) == CONST_INT)
99 HOST_WIDE_INT val = INTVAL (operands[1]);
101 if (((val & 0x80) && ! (val & 0xffffff00))
102 || ((val & 0x800000) && ! (val & 0xff000000)))
103 return \"movu %1,%0\";
105 return \"mov %1,%0\";
108 return \"movbu %1,%0\";
111 return \"fmov %1,%0\";
116 [(set_attr "cc" "none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
119 [(set (match_operand:QI 0 "nonimmediate_operand" "=d*a,d,d,!*a,d*a,d,m")
120 (match_operand:QI 1 "general_operand" "0,I,i,i,da,m,d"))]
121 "register_operand (operands[0], QImode)
122 || register_operand (operands[1], QImode)"
125 switch (which_alternative)
134 if (GET_CODE (operands[1]) == CONST_DOUBLE)
137 xoperands[0] = operands[0];
138 xoperands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
139 output_asm_insn (\"mov %1,%0\", xoperands);
143 return \"mov %1,%0\";
146 return \"movbu %1,%0\";
151 [(set_attr "cc" "none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
155 (define_expand "movhi"
156 [(set (match_operand:HI 0 "general_operand" "")
157 (match_operand:HI 1 "general_operand" ""))]
161 /* One of the ops has to be in a register */
162 if (!register_operand (operand1, HImode)
163 && !register_operand (operand0, HImode))
164 operands[1] = copy_to_mode_reg (HImode, operand1);
168 [(set (match_operand:HI 0 "nonimmediate_operand" "=d*x*a*f,d*x,d*x*a,d*x*a,m,*f,d*x*a")
169 (match_operand:HI 1 "general_operand" "0,I,d*x*ai,m,d*x*a,d*x*a*f,*f"))]
171 && (register_operand (operands[0], HImode)
172 || register_operand (operands[1], HImode))"
175 switch (which_alternative)
182 if (GET_CODE (operands[1]) == CONST_DOUBLE)
185 xoperands[0] = operands[0];
186 xoperands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
187 output_asm_insn (\"mov %1,%0\", xoperands);
191 if (REGNO_REG_CLASS (true_regnum (operands[0])) == EXTENDED_REGS
192 && GET_CODE (operands[1]) == CONST_INT)
194 HOST_WIDE_INT val = INTVAL (operands[1]);
196 if (((val & 0x80) && ! (val & 0xffffff00))
197 || ((val & 0x800000) && ! (val & 0xff000000)))
198 return \"movu %1,%0\";
200 return \"mov %1,%0\";
203 return \"movhu %1,%0\";
206 return \"fmov %1,%0\";
211 [(set_attr "cc" "none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
214 [(set (match_operand:HI 0 "nonimmediate_operand" "=d*a,d,d,!*a,d*a,d,m")
215 (match_operand:HI 1 "general_operand" "0,I,i,i,da,m,d"))]
216 "register_operand (operands[0], HImode)
217 || register_operand (operands[1], HImode)"
220 switch (which_alternative)
229 if (GET_CODE (operands[1]) == CONST_DOUBLE)
232 xoperands[0] = operands[0];
233 xoperands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
234 output_asm_insn (\"mov %1,%0\", xoperands);
237 return \"mov %1,%0\";
240 return \"movhu %1,%0\";
245 [(set_attr "cc" "none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
249 ;; We use this to handle addition of two values when one operand is the
250 ;; stack pointer and the other is a memory reference of some kind. Reload
251 ;; does not handle them correctly without this expander.
252 (define_expand "reload_insi"
253 [(set (match_operand:SI 0 "register_operand" "=a")
254 (match_operand:SI 1 "impossible_plus_operand" ""))
255 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
259 if (XEXP (operands[1], 0) == stack_pointer_rtx)
261 if (GET_CODE (XEXP (operands[1], 1)) == SUBREG
262 && (GET_MODE_SIZE (GET_MODE (XEXP (operands[1], 1)))
263 > GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (operands[1], 1))))))
264 emit_move_insn (operands[2],
266 (GET_MODE (XEXP (operands[1], 1)),
267 SUBREG_REG (XEXP (operands[1], 1))));
269 emit_move_insn (operands[2], XEXP (operands[1], 1));
270 emit_move_insn (operands[0], XEXP (operands[1], 0));
274 if (GET_CODE (XEXP (operands[1], 0)) == SUBREG
275 && (GET_MODE_SIZE (GET_MODE (XEXP (operands[1], 0)))
276 > GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (operands[1], 0))))))
277 emit_move_insn (operands[2],
279 (GET_MODE (XEXP (operands[1], 0)),
280 SUBREG_REG (XEXP (operands[1], 0))));
282 emit_move_insn (operands[2], XEXP (operands[1], 0));
283 emit_move_insn (operands[0], XEXP (operands[1], 1));
285 emit_insn (gen_addsi3 (operands[0], operands[0], operands[2]));
289 (define_insn "pop_pic_reg"
290 [(set (reg:SI PIC_REG)
291 (mem:SI (post_inc:SI (reg:SI SP_REG))))]
295 (define_expand "movsi"
296 [(set (match_operand:SI 0 "general_operand" "")
297 (match_operand:SI 1 "general_operand" ""))]
301 /* One of the ops has to be in a register */
302 if (!register_operand (operand1, SImode)
303 && !register_operand (operand0, SImode))
304 operands[1] = copy_to_mode_reg (SImode, operand1);
308 if (SYMBOLIC_CONST_P (operands[1]))
310 if (GET_CODE (operands[0]) == MEM)
311 operands[1] = force_reg (Pmode, operands[1]);
314 temp = (!can_create_pseudo_p ()
316 : gen_reg_rtx (Pmode));
317 operands[1] = legitimize_pic_address (operands[1], temp);
320 else if (GET_CODE (operands[1]) == CONST
321 && GET_CODE (XEXP (operands[1], 0)) == PLUS
322 && SYMBOLIC_CONST_P (XEXP (XEXP (operands[1], 0), 0)))
324 temp = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode);
325 temp = legitimize_pic_address (XEXP (XEXP (operands[1], 0), 0),
327 operands[1] = expand_binop (SImode, add_optab, temp,
328 XEXP (XEXP (operands[1], 0), 1),
329 (!can_create_pseudo_p ()
331 : gen_reg_rtx (Pmode)),
338 [(set (match_operand:SI 0 "nonimmediate_operand"
339 "=dx,ax,dx,a,dxm,dxm,axm,axm,dx,dx,ax,ax,axR,!*y,*f,*f,dxaQ")
340 (match_operand:SI 1 "general_operand"
341 "0,0,I,I,dx,ax,dx,ax,dixm,aixm,dixm,aixm,!*y,axR,0,dxaQi*f,*f"))]
342 "register_operand (operands[0], SImode)
343 || register_operand (operands[1], SImode)"
346 switch (which_alternative)
364 if (GET_CODE (operands[1]) == CONST_DOUBLE)
367 xoperands[0] = operands[0];
368 xoperands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
369 output_asm_insn (\"mov %1,%0\", xoperands);
373 if (REGNO_REG_CLASS (true_regnum (operands[0])) == EXTENDED_REGS
374 && GET_CODE (operands[1]) == CONST_INT)
376 HOST_WIDE_INT val = INTVAL (operands[1]);
378 if (((val & 0x80) && ! (val & 0xffffff00))
379 || ((val & 0x800000) && ! (val & 0xff000000)))
380 return \"movu %1,%0\";
382 return \"mov %1,%0\";
387 return \"fmov %1,%0\";
392 [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none,none_0hit,none_0hit")])
394 (define_expand "movsf"
395 [(set (match_operand:SF 0 "general_operand" "")
396 (match_operand:SF 1 "general_operand" ""))]
400 /* One of the ops has to be in a register */
401 if (!register_operand (operand1, SFmode)
402 && !register_operand (operand0, SFmode))
403 operands[1] = copy_to_mode_reg (SFmode, operand1);
407 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,dx,ax,dx,a,f,dxaQ,daxm,dax")
408 (match_operand:SF 1 "general_operand" "0,0,0,G,G,fdxaQF,f,dax,daxFm"))]
409 "register_operand (operands[0], SFmode)
410 || register_operand (operands[1], SFmode)"
413 switch (which_alternative)
424 return \"fmov %1, %0\";
428 if (REGNO_REG_CLASS (true_regnum (operands[0])) == EXTENDED_REGS
429 && GET_CODE (operands[1]) == CONST_INT)
431 HOST_WIDE_INT val = INTVAL (operands[1]);
433 if (((val & 0x80) && ! (val & 0xffffff00))
434 || ((val & 0x800000) && ! (val & 0xff000000)))
435 return \"movu %1,%0\";
437 return \"mov %1,%0\";
442 [(set_attr "cc" "none,none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
444 (define_expand "movdi"
445 [(set (match_operand:DI 0 "general_operand" "")
446 (match_operand:DI 1 "general_operand" ""))]
450 /* One of the ops has to be in a register */
451 if (!register_operand (operand1, DImode)
452 && !register_operand (operand0, DImode))
453 operands[1] = copy_to_mode_reg (DImode, operand1);
457 [(set (match_operand:DI 0 "nonimmediate_operand"
458 "=dx,ax,dx,a,dxm,dxm,axm,axm,dx,dx,ax,ax,*f,*f,*f,dxa,*f,Q")
459 (match_operand:DI 1 "general_operand"
460 "0,0,I,I,dx,ax,dx,ax,dxim,axim,dxim,axim,0,*f,dxai,*f,Q,*f"))]
461 "register_operand (operands[0], DImode)
462 || register_operand (operands[1], DImode)"
468 switch (which_alternative)
475 return \"clr %L0\;clr %H0\";
478 if (rtx_equal_p (operands[0], operands[1]))
479 return \"sub %L1,%L0\;mov %L0,%H0\";
481 return \"mov %1,%L0\;mov %L0,%H0\";
490 if (GET_CODE (operands[1]) == CONST_INT)
493 split_double (operands[1], &low, &high);
494 val[0] = INTVAL (low);
495 val[1] = INTVAL (high);
497 if (GET_CODE (operands[1]) == CONST_DOUBLE)
499 if (GET_MODE (operands[1]) == DFmode)
501 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
502 REAL_VALUE_TO_TARGET_DOUBLE (rv, val);
504 else if (GET_MODE (operands[1]) == VOIDmode
505 || GET_MODE (operands[1]) == DImode)
507 val[0] = CONST_DOUBLE_LOW (operands[1]);
508 val[1] = CONST_DOUBLE_HIGH (operands[1]);
512 if (GET_CODE (operands[1]) == MEM
513 && reg_overlap_mentioned_p (operands[0], XEXP (operands[1], 0)))
515 rtx temp = operands[0];
517 while (GET_CODE (temp) == SUBREG)
518 temp = SUBREG_REG (temp);
520 gcc_assert (GET_CODE (temp) == REG);
522 if (reg_overlap_mentioned_p (gen_rtx_REG (SImode, REGNO (temp)),
523 XEXP (operands[1], 0)))
524 return \"mov %H1,%H0\;mov %L1,%L0\";
526 return \"mov %L1,%L0\;mov %H1,%H0\";
529 else if (GET_CODE (operands[1]) == MEM
530 && CONSTANT_ADDRESS_P (XEXP (operands[1], 0))
531 && REGNO_REG_CLASS (REGNO (operands[0])) == ADDRESS_REGS)
535 xoperands[0] = operands[0];
536 xoperands[1] = XEXP (operands[1], 0);
538 output_asm_insn (\"mov %1,%L0\;mov (4,%L0),%H0\;mov (%L0),%L0\",
544 if ((GET_CODE (operands[1]) == CONST_INT
545 || GET_CODE (operands[1]) == CONST_DOUBLE)
548 if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
549 output_asm_insn (\"clr %L0\", operands);
551 output_asm_insn (\"mov %L1,%L0\", operands);
553 else if ((GET_CODE (operands[1]) == CONST_INT
554 || GET_CODE (operands[1]) == CONST_DOUBLE)
555 && (REGNO_REG_CLASS (true_regnum (operands[0]))
557 && (((val[0] & 0x80) && ! (val[0] & 0xffffff00))
558 || ((val[0] & 0x800000) && ! (val[0] & 0xff000000))))
559 output_asm_insn (\"movu %L1,%L0\", operands);
561 output_asm_insn (\"mov %L1,%L0\", operands);
563 if ((GET_CODE (operands[1]) == CONST_INT
564 || GET_CODE (operands[1]) == CONST_DOUBLE)
567 if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
568 output_asm_insn (\"clr %H0\", operands);
570 output_asm_insn (\"mov %H1,%H0\", operands);
572 else if ((GET_CODE (operands[1]) == CONST_INT
573 || GET_CODE (operands[1]) == CONST_DOUBLE)
575 output_asm_insn (\"mov %L0,%H0\", operands);
576 else if ((GET_CODE (operands[1]) == CONST_INT
577 || GET_CODE (operands[1]) == CONST_DOUBLE)
578 && (REGNO_REG_CLASS (true_regnum (operands[0]))
580 && (((val[1] & 0x80) && ! (val[1] & 0xffffff00))
581 || ((val[1] & 0x800000) && ! (val[1] & 0xff000000))))
582 output_asm_insn (\"movu %H1,%H0\", operands);
584 output_asm_insn (\"mov %H1,%H0\", operands);
592 return \"fmov %L1, %L0\;fmov %H1, %H0\";
594 if (GET_CODE (operands[1]) == MEM
595 && GET_CODE (XEXP (operands[1], 0)) == CONST_INT
596 && (INTVAL (XEXP (operands[1], 0)) & 7) == 0)
597 return \"fmov %D1, %D0\";
599 return \"fmov %L1, %L0\;fmov %H1, %H0\";
601 if (GET_CODE (operands[0]) == MEM
602 && GET_CODE (XEXP (operands[0], 0)) == CONST_INT
603 && (INTVAL (XEXP (operands[0], 0)) & 7) == 0)
604 return \"fmov %D1, %D0\";
606 return \"fmov %L1, %L0\;fmov %H1, %H0\";
614 (ior (lt (symbol_ref "which_alternative") (const_int 2))
615 (eq (symbol_ref "which_alternative") (const_int 12))
616 ) (const_string "none")
617 (eq (symbol_ref "which_alternative") (const_int 2)
618 ) (const_string "clobber")
619 (eq (symbol_ref "which_alternative") (const_int 3)
621 (ne (symbol_ref "rtx_equal_p (operands[0], operands[1])")
622 (const_int 0)) (const_string "clobber")
623 (const_string "none_0hit"))
624 (ior (eq (symbol_ref "which_alternative") (const_int 8))
625 (eq (symbol_ref "which_alternative") (const_int 9))
627 (ne (symbol_ref "mn10300_wide_const_load_uses_clr
629 (const_int 0)) (const_string "clobber")
630 (const_string "none_0hit"))
631 ] (const_string "none_0hit")))])
633 (define_expand "movdf"
634 [(set (match_operand:DF 0 "general_operand" "")
635 (match_operand:DF 1 "general_operand" ""))]
639 /* One of the ops has to be in a register */
640 if (!register_operand (operand1, DFmode)
641 && !register_operand (operand0, DFmode))
642 operands[1] = copy_to_mode_reg (DFmode, operand1);
646 [(set (match_operand:DF 0 "nonimmediate_operand"
647 "=f,dx,ax,dx,f,f,dxa,f,Q,a,dxm,dxm,axm,axm,dx,dx,ax,ax")
648 (match_operand:DF 1 "general_operand"
649 "0,0,0,G,f,dxaF,f,Q,f,G,dx,ax,dx,ax,dxFm,axFm,dxFm,axFm"))]
650 "register_operand (operands[0], DFmode)
651 || register_operand (operands[1], DFmode)"
657 switch (which_alternative)
665 return \"clr %L0\;clr %H0\";
670 return \"fmov %L1, %L0\;fmov %H1, %H0\";
673 if (GET_CODE (operands[1]) == MEM
674 && GET_CODE (XEXP (operands[1], 0)) == CONST_INT
675 && (INTVAL (XEXP (operands[1], 0)) & 7) == 0)
676 return \"fmov %D1, %D0\";
678 return \"fmov %L1, %L0\;fmov %H1, %H0\";
681 if (GET_CODE (operands[0]) == MEM
682 && GET_CODE (XEXP (operands[0], 0)) == CONST_INT
683 && (INTVAL (XEXP (operands[0], 0)) & 7) == 0)
684 return \"fmov %D1, %D0\";
686 return \"fmov %L1, %L0\;fmov %H1, %H0\";
689 if (rtx_equal_p (operands[0], operands[1]))
690 return \"sub %L1,%L0\;mov %L0,%H0\";
692 return \"mov %1,%L0\;mov %L0,%H0\";
701 if (GET_CODE (operands[1]) == CONST_INT)
704 split_double (operands[1], &low, &high);
705 val[0] = INTVAL (low);
706 val[1] = INTVAL (high);
708 if (GET_CODE (operands[1]) == CONST_DOUBLE)
710 if (GET_MODE (operands[1]) == DFmode)
712 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
713 REAL_VALUE_TO_TARGET_DOUBLE (rv, val);
715 else if (GET_MODE (operands[1]) == VOIDmode
716 || GET_MODE (operands[1]) == DImode)
718 val[0] = CONST_DOUBLE_LOW (operands[1]);
719 val[1] = CONST_DOUBLE_HIGH (operands[1]);
723 if (GET_CODE (operands[1]) == MEM
724 && reg_overlap_mentioned_p (operands[0], XEXP (operands[1], 0)))
726 rtx temp = operands[0];
728 while (GET_CODE (temp) == SUBREG)
729 temp = SUBREG_REG (temp);
731 gcc_assert (GET_CODE (temp) == REG);
733 if (reg_overlap_mentioned_p (gen_rtx_REG (SImode, REGNO (temp)),
734 XEXP (operands[1], 0)))
735 return \"mov %H1,%H0\;mov %L1,%L0\";
737 return \"mov %L1,%L0\;mov %H1,%H0\";
740 else if (GET_CODE (operands[1]) == MEM
741 && CONSTANT_ADDRESS_P (XEXP (operands[1], 0))
742 && REGNO_REG_CLASS (REGNO (operands[0])) == ADDRESS_REGS)
746 xoperands[0] = operands[0];
747 xoperands[1] = XEXP (operands[1], 0);
749 output_asm_insn (\"mov %1,%L0\;mov (4,%L0),%H0\;mov (%L0),%L0\",
755 if ((GET_CODE (operands[1]) == CONST_INT
756 || GET_CODE (operands[1]) == CONST_DOUBLE)
759 if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
760 output_asm_insn (\"clr %L0\", operands);
762 output_asm_insn (\"mov %L1,%L0\", operands);
764 else if ((GET_CODE (operands[1]) == CONST_INT
765 || GET_CODE (operands[1]) == CONST_DOUBLE)
766 && (REGNO_REG_CLASS (true_regnum (operands[0]))
768 && (((val[0] & 0x80) && ! (val[0] & 0xffffff00))
769 || ((val[0] & 0x800000) && ! (val[0] & 0xff000000))))
770 output_asm_insn (\"movu %L1,%L0\", operands);
772 output_asm_insn (\"mov %L1,%L0\", operands);
774 if ((GET_CODE (operands[1]) == CONST_INT
775 || GET_CODE (operands[1]) == CONST_DOUBLE)
778 if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
779 output_asm_insn (\"clr %H0\", operands);
781 output_asm_insn (\"mov %H1,%H0\", operands);
783 else if ((GET_CODE (operands[1]) == CONST_INT
784 || GET_CODE (operands[1]) == CONST_DOUBLE)
786 output_asm_insn (\"mov %L0,%H0\", operands);
787 else if ((GET_CODE (operands[1]) == CONST_INT
788 || GET_CODE (operands[1]) == CONST_DOUBLE)
789 && (REGNO_REG_CLASS (true_regnum (operands[0]))
791 && (((val[1] & 0x80) && ! (val[1] & 0xffffff00))
792 || ((val[1] & 0x800000) && ! (val[1] & 0xff000000))))
793 output_asm_insn (\"movu %H1,%H0\", operands);
795 output_asm_insn (\"mov %H1,%H0\", operands);
805 (lt (symbol_ref "which_alternative") (const_int 3)
806 ) (const_string "none")
807 (eq (symbol_ref "which_alternative") (const_int 3)
808 ) (const_string "clobber")
809 (eq (symbol_ref "which_alternative") (const_int 9)
811 (ne (symbol_ref "rtx_equal_p (operands[0], operands[1])")
812 (const_int 0)) (const_string "clobber")
813 (const_string "none_0hit"))
814 (ior (eq (symbol_ref "which_alternative") (const_int 14))
815 (eq (symbol_ref "which_alternative") (const_int 15))
817 (ne (symbol_ref "mn10300_wide_const_load_uses_clr
819 (const_int 0)) (const_string "clobber")
820 (const_string "none_0hit"))
821 ] (const_string "none_0hit")))])
825 ;; ----------------------------------------------------------------------
827 ;; ----------------------------------------------------------------------
829 (define_insn "*tst_extqisi_am33"
831 (zero_extend:SI (match_operand:QI 0 "memory_operand" "dx,!a"))
834 "* return output_tst (operands[0], insn);"
835 [(set_attr "cc" "set_znv")])
837 (define_insn "*tst_extqisi"
839 (zero_extend:SI (match_operand:QI 0 "memory_operand" "dx"))
842 "* return output_tst (operands[0], insn);"
843 [(set_attr "cc" "set_znv")])
845 (define_insn "*tst_exthisi_am33"
847 (zero_extend:SI (match_operand:HI 0 "memory_operand" "dx,!a"))
850 "* return output_tst (operands[0], insn);"
851 [(set_attr "cc" "set_znv")])
853 (define_insn "*tst_exthisi"
855 (zero_extend:SI (match_operand:HI 0 "memory_operand" "dx"))
858 "* return output_tst (operands[0], insn);"
859 [(set_attr "cc" "set_znv")])
861 ;; Ordinarily, the cmp instruction will set the Z bit of cc0 to 1 if
862 ;; its operands hold equal values, but the operands of a cmp
863 ;; instruction must be distinct registers. In the case where we'd
864 ;; like to compare a register to itself, we can achieve this effect
865 ;; with a btst 0,d0 instead. (This will not alter the contents of d0
866 ;; but will have the proper effect on cc0. Using d0 is arbitrary; any
867 ;; data register would work.)
869 ;; Even though the first alternative would be preferable if it can
870 ;; possibly match, reload must not be given the opportunity to attempt
871 ;; to use it. It assumes that such matches can only occur when one of
872 ;; the operands is used for input and the other for output. Since
873 ;; this is not the case, it abort()s. Indeed, such a reload cannot be
874 ;; possibly satisfied, so just mark the alternative with a `!', so
875 ;; that it is not considered by reload.
877 (define_insn "*cmpsi"
879 (compare (match_operand:SI 0 "register_operand" "!*d*a*x,dax,dax")
880 (match_operand:SI 1 "nonmemory_operand" "*0,I,daxi")))]
884 if (which_alternative == 0)
885 return \"btst 0,d0\";
886 if (which_alternative == 1)
887 return output_tst (operands[0], insn);
888 return \"cmp %1,%0\";
890 [(set_attr "cc" "compare,set_znv,compare")])
892 (define_insn "*cmpsf"
894 (compare (match_operand:SF 0 "register_operand" "f,f")
895 (match_operand:SF 1 "nonmemory_operand" "f,F")))]
898 [(set_attr "cc" "compare,compare")])
900 ;; ----------------------------------------------------------------------
902 ;; ----------------------------------------------------------------------
904 (define_expand "addsi3"
905 [(set (match_operand:SI 0 "register_operand" "")
906 (plus:SI (match_operand:SI 1 "register_operand" "")
907 (match_operand:SI 2 "nonmemory_operand" "")))]
912 [(set (match_operand:SI 0 "register_operand" "=dx,a,x,a,dax,!*y,!dax")
913 (plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,dax")
914 (match_operand:SI 2 "nonmemory_operand" "J,J,L,L,daxi,i,dax")))]
918 switch (which_alternative)
928 return \"add %2,%0\";
931 enum reg_class src1_class, src2_class, dst_class;
933 src1_class = REGNO_REG_CLASS (true_regnum (operands[1]));
934 src2_class = REGNO_REG_CLASS (true_regnum (operands[2]));
935 dst_class = REGNO_REG_CLASS (true_regnum (operands[0]));
937 /* I'm not sure if this can happen or not. Might as well be prepared
938 and generate the best possible code if it does happen. */
939 if (true_regnum (operands[0]) == true_regnum (operands[1]))
940 return \"add %2,%0\";
941 if (true_regnum (operands[0]) == true_regnum (operands[2]))
942 return \"add %1,%0\";
944 /* Catch cases where no extended register was used. These should be
945 handled just like the mn10300. */
946 if (src1_class != EXTENDED_REGS
947 && src2_class != EXTENDED_REGS
948 && dst_class != EXTENDED_REGS)
950 /* We have to copy one of the sources into the destination, then
951 add the other source to the destination.
953 Carefully select which source to copy to the destination; a naive
954 implementation will waste a byte when the source classes are
955 different and the destination is an address register. Selecting
956 the lowest cost register copy will optimize this sequence. */
957 if (REGNO_REG_CLASS (true_regnum (operands[1]))
958 == REGNO_REG_CLASS (true_regnum (operands[0])))
959 return \"mov %1,%0\;add %2,%0\";
960 return \"mov %2,%0\;add %1,%0\";
963 /* At least one register is an extended register. */
965 /* The three operand add instruction on the am33 is a win iff the
966 output register is an extended register, or if both source
967 registers are extended registers. */
968 if (dst_class == EXTENDED_REGS
969 || src1_class == src2_class)
970 return \"add %2,%1,%0\";
972 /* It is better to copy one of the sources to the destination, then
973 perform a 2 address add. The destination in this case must be
974 an address or data register and one of the sources must be an
975 extended register and the remaining source must not be an extended
978 The best code for this case is to copy the extended reg to the
979 destination, then emit a two address add. */
980 if (src1_class == EXTENDED_REGS)
981 return \"mov %1,%0\;add %2,%0\";
982 return \"mov %2,%0\;add %1,%0\";
988 [(set_attr "cc" "set_zn,none_0hit,set_zn,none_0hit,set_zn,none_0hit,set_zn")])
991 [(set (match_operand:SI 0 "register_operand" "=dx,a,a,dax,!*y,!dax")
992 (plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,dax")
993 (match_operand:SI 2 "nonmemory_operand" "J,J,L,daxi,i,dax")))]
997 switch (which_alternative)
1006 return \"add %2,%0\";
1008 /* I'm not sure if this can happen or not. Might as well be prepared
1009 and generate the best possible code if it does happen. */
1010 if (true_regnum (operands[0]) == true_regnum (operands[1]))
1011 return \"add %2,%0\";
1012 if (true_regnum (operands[0]) == true_regnum (operands[2]))
1013 return \"add %1,%0\";
1015 /* We have to copy one of the sources into the destination, then add
1016 the other source to the destination.
1018 Carefully select which source to copy to the destination; a naive
1019 implementation will waste a byte when the source classes are different
1020 and the destination is an address register. Selecting the lowest
1021 cost register copy will optimize this sequence. */
1022 if (REGNO_REG_CLASS (true_regnum (operands[1]))
1023 == REGNO_REG_CLASS (true_regnum (operands[0])))
1024 return \"mov %1,%0\;add %2,%0\";
1025 return \"mov %2,%0\;add %1,%0\";
1030 [(set_attr "cc" "set_zn,none_0hit,none_0hit,set_zn,none_0hit,set_zn")])
1032 ;; ----------------------------------------------------------------------
1033 ;; SUBTRACT INSTRUCTIONS
1034 ;; ----------------------------------------------------------------------
1036 (define_expand "subsi3"
1037 [(set (match_operand:SI 0 "register_operand" "")
1038 (minus:SI (match_operand:SI 1 "register_operand" "")
1039 (match_operand:SI 2 "nonmemory_operand" "")))]
1044 [(set (match_operand:SI 0 "register_operand" "=dax,!dax")
1045 (minus:SI (match_operand:SI 1 "register_operand" "0,dax")
1046 (match_operand:SI 2 "nonmemory_operand" "daxi,dax")))]
1050 if (true_regnum (operands[0]) == true_regnum (operands[1]))
1051 return \"sub %2,%0\";
1054 enum reg_class src1_class, src2_class, dst_class;
1056 src1_class = REGNO_REG_CLASS (true_regnum (operands[1]));
1057 src2_class = REGNO_REG_CLASS (true_regnum (operands[2]));
1058 dst_class = REGNO_REG_CLASS (true_regnum (operands[0]));
1060 /* If no extended registers are used, then the best way to handle
1061 this is to copy the first source operand into the destination
1062 and emit a two address subtraction. */
1063 if (src1_class != EXTENDED_REGS
1064 && src2_class != EXTENDED_REGS
1065 && dst_class != EXTENDED_REGS
1066 && true_regnum (operands[0]) != true_regnum (operands[2]))
1067 return \"mov %1,%0\;sub %2,%0\";
1068 return \"sub %2,%1,%0\";
1071 [(set_attr "cc" "set_zn")])
1074 [(set (match_operand:SI 0 "register_operand" "=dax")
1075 (minus:SI (match_operand:SI 1 "register_operand" "0")
1076 (match_operand:SI 2 "nonmemory_operand" "daxi")))]
1079 [(set_attr "cc" "set_zn")])
1081 (define_expand "negsi2"
1082 [(set (match_operand:SI 0 "register_operand" "")
1083 (neg:SI (match_operand:SI 1 "register_operand" "")))]
1087 rtx target = gen_reg_rtx (SImode);
1089 emit_move_insn (target, const0_rtx);
1090 emit_insn (gen_subsi3 (target, target, operands[1]));
1091 emit_move_insn (operands[0], target);
1095 ;; ----------------------------------------------------------------------
1096 ;; MULTIPLY INSTRUCTIONS
1097 ;; ----------------------------------------------------------------------
1099 (define_insn "mulsidi3"
1100 [(set (match_operand:DI 0 "register_operand" "=dax")
1101 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "dax"))
1102 (sign_extend:DI (match_operand:SI 2 "register_operand" "dax"))))]
1105 [(set_attr "cc" "set_zn")])
1107 (define_insn "umulsidi3"
1108 [(set (match_operand:DI 0 "register_operand" "=dax")
1109 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "dax"))
1110 (zero_extend:DI (match_operand:SI 2 "register_operand" "dax"))))]
1112 "mulu %1,%2,%H0,%L0"
1113 [(set_attr "cc" "set_zn")])
1115 (define_expand "mulsi3"
1116 [(set (match_operand:SI 0 "register_operand" "")
1117 (mult:SI (match_operand:SI 1 "register_operand" "")
1118 (match_operand:SI 2 "register_operand" "")))]
1123 [(set (match_operand:SI 0 "register_operand" "=dx,!dax")
1124 (mult:SI (match_operand:SI 1 "register_operand" "%0,0")
1125 (match_operand:SI 2 "nonmemory_operand" "dx,daxi")))]
1129 if (TARGET_MULT_BUG)
1130 return \"nop\;nop\;mul %2,%0\";
1132 return \"mul %2,%0\";
1134 [(set_attr "cc" "set_zn")])
1137 [(set (match_operand:SI 0 "register_operand" "=dx")
1138 (mult:SI (match_operand:SI 1 "register_operand" "%0")
1139 (match_operand:SI 2 "register_operand" "dx")))]
1143 if (TARGET_MULT_BUG)
1144 return \"nop\;nop\;mul %2,%0\";
1146 return \"mul %2,%0\";
1148 [(set_attr "cc" "set_zn")])
1150 (define_insn "udivmodsi4"
1151 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx")
1152 (udiv:SI (match_operand:SI 1 "general_operand" "0")
1153 (match_operand:SI 2 "general_operand" "dx")))
1154 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
1155 (umod:SI (match_dup 1) (match_dup 2)))]
1159 output_asm_insn (\"sub %3,%3\;mov %3,mdr\", operands);
1161 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1162 return \"divu %2,%0\";
1164 return \"divu %2,%0\;mov mdr,%3\";
1166 [(set_attr "cc" "set_zn")])
1168 (define_insn "divmodsi4"
1169 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx")
1170 (div:SI (match_operand:SI 1 "general_operand" "0")
1171 (match_operand:SI 2 "general_operand" "dx")))
1172 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
1173 (mod:SI (match_dup 1) (match_dup 2)))]
1177 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1178 return \"ext %0\;div %2,%0\";
1180 return \"ext %0\;div %2,%0\;mov mdr,%3\";
1182 [(set_attr "cc" "set_zn")])
1185 ;; ----------------------------------------------------------------------
1187 ;; ----------------------------------------------------------------------
1189 (define_expand "andsi3"
1190 [(set (match_operand:SI 0 "register_operand" "")
1191 (and:SI (match_operand:SI 1 "register_operand" "")
1192 (match_operand:SI 2 "nonmemory_operand" "")))]
1197 [(set (match_operand:SI 0 "register_operand" "=dx,dx,!dax")
1198 (and:SI (match_operand:SI 1 "register_operand" "%0,0,dax")
1199 (match_operand:SI 2 "nonmemory_operand" "N,dxi,dax")))]
1203 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xff)
1204 return \"extbu %0\";
1205 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xffff)
1206 return \"exthu %0\";
1207 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x7fffffff)
1208 return \"add %0,%0\;lsr 1,%0\";
1209 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x3fffffff)
1210 return \"asl2 %0\;lsr 2,%0\";
1211 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x1fffffff)
1212 return \"add %0,%0\;asl2 %0\;lsr 3,%0\";
1213 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x0fffffff)
1214 return \"asl2 %0\;asl2 %0\;lsr 4,%0\";
1215 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffe)
1216 return \"lsr 1,%0\;add %0,%0\";
1217 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffc)
1218 return \"lsr 2,%0\;asl2 %0\";
1219 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff8)
1220 return \"lsr 3,%0\;add %0,%0\;asl2 %0\";
1221 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff0)
1222 return \"lsr 4,%0\;asl2 %0\;asl2 %0\";
1223 if (REG_P (operands[2]) && REG_P (operands[1])
1224 && true_regnum (operands[0]) != true_regnum (operands[1])
1225 && true_regnum (operands[0]) != true_regnum (operands[2])
1226 && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS
1227 && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS
1228 && REGNO_REG_CLASS (true_regnum (operands[2])) == DATA_REGS)
1229 return \"mov %1,%0\;and %2,%0\";
1230 if (REG_P (operands[2]) && REG_P (operands[1])
1231 && true_regnum (operands[0]) != true_regnum (operands[1])
1232 && true_regnum (operands[0]) != true_regnum (operands[2]))
1233 return \"and %1,%2,%0\";
1234 if (REG_P (operands[2]) && REG_P (operands[0])
1235 && true_regnum (operands[2]) == true_regnum (operands[0]))
1236 return \"and %1,%0\";
1237 return \"and %2,%0\";
1242 (eq (symbol_ref "which_alternative") (const_int 0)
1243 ) (const_string "none_0hit")
1244 (ne (symbol_ref "GET_CODE (operands[2]) == CONST_INT
1245 && (INTVAL (operands[2]) == 0x7fffffff
1246 || INTVAL (operands[2]) == 0x3fffffff
1247 || INTVAL (operands[2]) == 0x1fffffff
1248 || INTVAL (operands[2]) == 0x0fffffff
1249 || INTVAL (operands[2]) == 0xfffffffe
1250 || INTVAL (operands[2]) == 0xfffffffc
1251 || INTVAL (operands[2]) == 0xfffffff8
1252 || INTVAL (operands[2]) == 0xfffffff0)")
1253 (const_int 0)) (const_string "set_zn")
1254 ] (const_string "set_znv")))])
1257 [(set (match_operand:SI 0 "register_operand" "=dx,dx")
1258 (and:SI (match_operand:SI 1 "register_operand" "%0,0")
1259 (match_operand:SI 2 "nonmemory_operand" "N,dxi")))]
1263 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xff)
1264 return \"extbu %0\";
1265 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xffff)
1266 return \"exthu %0\";
1267 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x7fffffff)
1268 return \"add %0,%0\;lsr 1,%0\";
1269 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x3fffffff)
1270 return \"asl2 %0\;lsr 2,%0\";
1271 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x1fffffff)
1272 return \"add %0,%0\;asl2 %0\;lsr 3,%0\";
1273 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x0fffffff)
1274 return \"asl2 %0\;asl2 %0\;lsr 4,%0\";
1275 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffe)
1276 return \"lsr 1,%0\;add %0,%0\";
1277 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffc)
1278 return \"lsr 2,%0\;asl2 %0\";
1279 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff8)
1280 return \"lsr 3,%0\;add %0,%0\;asl2 %0\";
1281 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff0)
1282 return \"lsr 4,%0\;asl2 %0\;asl2 %0\";
1283 return \"and %2,%0\";
1288 (eq (symbol_ref "which_alternative") (const_int 0)
1289 ) (const_string "none_0hit")
1290 ;; Shifts don't set the V flag, but bitwise operations clear
1291 ;; it (which correctly reflects the absence of overflow in a
1292 ;; compare-with-zero that might follow). As for the
1293 ;; 0xfffffffe case, the add may overflow, so we can't use the
1295 (ne (symbol_ref "GET_CODE (operands[2]) == CONST_INT
1296 && (INTVAL (operands[2]) == 0x7fffffff
1297 || INTVAL (operands[2]) == 0x3fffffff
1298 || INTVAL (operands[2]) == 0x1fffffff
1299 || INTVAL (operands[2]) == 0x0fffffff
1300 || INTVAL (operands[2]) == 0xfffffffe
1301 || INTVAL (operands[2]) == 0xfffffffc
1302 || INTVAL (operands[2]) == 0xfffffff8
1303 || INTVAL (operands[2]) == 0xfffffff0)")
1304 (const_int 0)) (const_string "set_zn")
1305 ] (const_string "set_znv")))])
1307 ;; ----------------------------------------------------------------------
1309 ;; ----------------------------------------------------------------------
1311 (define_expand "iorsi3"
1312 [(set (match_operand:SI 0 "register_operand" "")
1313 (ior:SI (match_operand:SI 1 "register_operand" "")
1314 (match_operand:SI 2 "nonmemory_operand" "")))]
1319 [(set (match_operand:SI 0 "register_operand" "=dx,!dax")
1320 (ior:SI (match_operand:SI 1 "register_operand" "%0,dax")
1321 (match_operand:SI 2 "nonmemory_operand" "dxi,dax")))]
1325 if (REG_P (operands[2]) && REG_P (operands[1])
1326 && true_regnum (operands[0]) != true_regnum (operands[1])
1327 && true_regnum (operands[0]) != true_regnum (operands[2])
1328 && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS
1329 && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS
1330 && REGNO_REG_CLASS (true_regnum (operands[2])) == DATA_REGS)
1331 return \"mov %1,%0\;or %2,%0\";
1332 if (REG_P (operands[2]) && REG_P (operands[1])
1333 && true_regnum (operands[0]) != true_regnum (operands[1])
1334 && true_regnum (operands[0]) != true_regnum (operands[2]))
1335 return \"or %1,%2,%0\";
1336 if (REG_P (operands[2]) && REG_P (operands[0])
1337 && true_regnum (operands[2]) == true_regnum (operands[0]))
1338 return \"or %1,%0\";
1339 return \"or %2,%0\";
1341 [(set_attr "cc" "set_znv")])
1344 [(set (match_operand:SI 0 "register_operand" "=dx")
1345 (ior:SI (match_operand:SI 1 "register_operand" "%0")
1346 (match_operand:SI 2 "nonmemory_operand" "dxi")))]
1349 [(set_attr "cc" "set_znv")])
1351 ;; ----------------------------------------------------------------------
1353 ;; ----------------------------------------------------------------------
1355 (define_expand "xorsi3"
1356 [(set (match_operand:SI 0 "register_operand" "")
1357 (xor:SI (match_operand:SI 1 "register_operand" "")
1358 (match_operand:SI 2 "nonmemory_operand" "")))]
1363 [(set (match_operand:SI 0 "register_operand" "=dx,!dax")
1364 (xor:SI (match_operand:SI 1 "register_operand" "%0,dax")
1365 (match_operand:SI 2 "nonmemory_operand" "dxi,dax")))]
1369 if (REG_P (operands[2]) && REG_P (operands[1])
1370 && true_regnum (operands[0]) != true_regnum (operands[1])
1371 && true_regnum (operands[0]) != true_regnum (operands[2])
1372 && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS
1373 && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS
1374 && REGNO_REG_CLASS (true_regnum (operands[2])) == DATA_REGS)
1375 return \"mov %1,%0\;xor %2,%0\";
1376 if (REG_P (operands[2]) && REG_P (operands[1])
1377 && true_regnum (operands[0]) != true_regnum (operands[1])
1378 && true_regnum (operands[0]) != true_regnum (operands[2]))
1379 return \"xor %1,%2,%0\";
1380 if (REG_P (operands[2]) && REG_P (operands[0])
1381 && true_regnum (operands[2]) == true_regnum (operands[0]))
1382 return \"xor %1,%0\";
1383 return \"xor %2,%0\";
1385 [(set_attr "cc" "set_znv")])
1388 [(set (match_operand:SI 0 "register_operand" "=dx")
1389 (xor:SI (match_operand:SI 1 "register_operand" "%0")
1390 (match_operand:SI 2 "nonmemory_operand" "dxi")))]
1393 [(set_attr "cc" "set_znv")])
1395 ;; ----------------------------------------------------------------------
1397 ;; ----------------------------------------------------------------------
1399 (define_expand "one_cmplsi2"
1400 [(set (match_operand:SI 0 "register_operand" "")
1401 (not:SI (match_operand:SI 1 "register_operand" "")))]
1406 [(set (match_operand:SI 0 "register_operand" "=dx,!dax")
1407 (not:SI (match_operand:SI 1 "register_operand" "0,0")))]
1410 [(set_attr "cc" "set_znv")])
1413 [(set (match_operand:SI 0 "register_operand" "=dx")
1414 (not:SI (match_operand:SI 1 "register_operand" "0")))]
1417 [(set_attr "cc" "set_znv")])
1419 ;; -----------------------------------------------------------------
1421 ;; -----------------------------------------------------------------
1424 ;; These set/clear memory in byte sized chunks.
1426 ;; They are no smaller/faster than loading the value into a register
1427 ;; and storing the register, but they don't need a scratch register
1428 ;; which may allow for better code generation.
1430 [(set (match_operand:QI 0 "nonimmediate_operand" "=R,d") (const_int 0))]
1435 [(set_attr "cc" "clobber")])
1438 [(set (match_operand:QI 0 "nonimmediate_operand" "=R,d") (const_int -1))]
1443 [(set_attr "cc" "clobber,none_0hit")])
1446 [(set (match_operand:QI 0 "nonimmediate_operand" "+R,d")
1448 (and:SI (subreg:SI (match_dup 0) 0)
1449 (match_operand:SI 1 "const_int_operand" "i,i")) 0))]
1454 [(set_attr "cc" "clobber,set_znv")])
1457 [(set (match_operand:QI 0 "memory_operand" "=R,T")
1460 (not:QI (match_operand:QI 1 "nonmemory_operand" "i,d"))))]
1465 [(set_attr "cc" "clobber,clobber")])
1468 [(set (match_operand:QI 0 "nonimmediate_operand" "+R,d")
1470 (ior:SI (subreg:SI (match_dup 0) 0)
1471 (match_operand:SI 1 "const_int_operand" "i,i")) 0))]
1476 [(set_attr "cc" "clobber,set_znv")])
1478 (define_expand "iorqi3"
1479 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1480 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
1481 (match_operand:QI 2 "nonmemory_operand" "")))]
1486 [(set (match_operand:QI 0 "nonimmediate_operand" "=R,T,r")
1487 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
1488 ;; This constraint should really be nonmemory_operand,
1489 ;; but making it general_operand, along with the
1490 ;; condition that not both input operands are MEMs, it
1491 ;; here helps combine do a better job.
1492 (match_operand:QI 2 "general_operand" "i,d,ir")))]
1494 (GET_CODE (operands[2]) != MEM || GET_CODE (operands[1]) != MEM)"
1499 [(set_attr "cc" "clobber,clobber,set_znv")])
1502 [(set (match_operand:QI 0 "nonimmediate_operand" "=R,T,d")
1503 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
1504 ;; This constraint should really be nonmemory_operand,
1505 ;; but making it general_operand, along with the
1506 ;; condition that not both input operands are MEMs, it
1507 ;; here helps combine do a better job.
1508 (match_operand:QI 2 "general_operand" "i,d,id")))]
1509 "GET_CODE (operands[2]) != MEM || GET_CODE (operands[1]) != MEM"
1514 [(set_attr "cc" "clobber,clobber,set_znv")])
1518 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "dx")
1519 (match_operand 1 "const_int_operand" "")
1520 (match_operand 2 "const_int_operand" ""))
1525 int len = INTVAL (operands[1]);
1526 int bit = INTVAL (operands[2]);
1537 xoperands[0] = operands[0];
1538 xoperands[1] = GEN_INT (trunc_int_for_mode (mask, SImode));
1539 output_asm_insn (\"btst %1,%0\", xoperands);
1542 [(set_attr "cc" "clobber")])
1546 (compare (zero_extract:SI (match_operand:QI 0 "general_operand" "R,dx")
1547 (match_operand 1 "const_int_operand" "")
1548 (match_operand 2 "const_int_operand" ""))
1550 "mask_ok_for_mem_btst (INTVAL (operands[1]), INTVAL (operands[2]))"
1553 int len = INTVAL (operands[1]);
1554 int bit = INTVAL (operands[2]);
1565 /* If the source operand is not a reg (i.e. it is memory), then extract the
1566 bits from mask that we actually want to test. Note that the mask will
1567 never cross a byte boundary. */
1568 if (!REG_P (operands[0]))
1572 else if (mask & 0xff00)
1573 mask = (mask >> 8) & 0xff;
1574 else if (mask & 0xff0000)
1575 mask = (mask >> 16) & 0xff;
1576 else if (mask & 0xff000000)
1577 mask = (mask >> 24) & 0xff;
1580 xoperands[0] = operands[0];
1581 xoperands[1] = GEN_INT (trunc_int_for_mode (mask, SImode));
1582 if (GET_CODE (operands[0]) == REG)
1583 output_asm_insn (\"btst %1,%0\", xoperands);
1585 output_asm_insn (\"btst %U1,%A0\", xoperands);
1588 [(set_attr "cc" "clobber")])
1591 [(set (cc0) (compare (and:SI (match_operand:SI 0 "register_operand" "dx")
1592 (match_operand:SI 1 "const_int_operand" ""))
1596 [(set_attr "cc" "clobber")])
1601 (subreg:SI (match_operand:QI 0 "general_operand" "R,dx") 0)
1602 (match_operand:SI 1 "const_8bit_operand" ""))
1608 [(set_attr "cc" "clobber")])
1611 ;; ----------------------------------------------------------------------
1612 ;; JUMP INSTRUCTIONS
1613 ;; ----------------------------------------------------------------------
1615 (define_expand "cbranchsi4"
1617 (compare (match_operand:SI 1 "register_operand" "")
1618 (match_operand:SI 2 "nonmemory_operand" "")))
1621 (match_operator 0 "ordered_comparison_operator" [(cc0)
1623 (label_ref (match_operand 3 "" ""))
1628 (define_expand "cbranchsf4"
1630 (compare (match_operand:SF 1 "register_operand" "")
1631 (match_operand:SF 2 "nonmemory_operand" "")))
1634 (match_operator 0 "ordered_comparison_operator" [(cc0)
1636 (label_ref (match_operand 3 "" ""))
1642 ;; Conditional jump instructions
1646 (if_then_else (match_operator 1 "comparison_operator"
1647 [(cc0) (const_int 0)])
1648 (label_ref (match_operand 0 "" ""))
1653 if (cc_status.mdep.fpCC)
1654 return \"fb%b1 %0\";
1655 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0
1656 && (GET_CODE (operands[1]) == GT
1657 || GET_CODE (operands[1]) == GE
1658 || GET_CODE (operands[1]) == LE
1659 || GET_CODE (operands[1]) == LT))
1663 [(set_attr "cc" "none")])
1667 (if_then_else (match_operator 1 "comparison_operator"
1668 [(cc0) (const_int 0)])
1670 (label_ref (match_operand 0 "" ""))))]
1674 if (cc_status.mdep.fpCC)
1675 return \"fb%B1 %0\";
1676 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0
1677 && (GET_CODE (operands[1]) == GT
1678 || GET_CODE (operands[1]) == GE
1679 || GET_CODE (operands[1]) == LE
1680 || GET_CODE (operands[1]) == LT))
1684 [(set_attr "cc" "none")])
1686 ;; Unconditional and other jump instructions.
1690 (label_ref (match_operand 0 "" "")))]
1693 [(set_attr "cc" "none")])
1695 (define_insn "indirect_jump"
1696 [(set (pc) (match_operand:SI 0 "register_operand" "a"))]
1699 [(set_attr "cc" "none")])
1701 (define_expand "builtin_setjmp_receiver"
1702 [(match_operand 0 "" "")]
1707 emit_insn (gen_GOTaddr2picreg ());
1712 (define_expand "casesi"
1713 [(match_operand:SI 0 "register_operand" "")
1714 (match_operand:SI 1 "immediate_operand" "")
1715 (match_operand:SI 2 "immediate_operand" "")
1716 (match_operand 3 "" "") (match_operand 4 "" "")]
1720 rtx table = gen_reg_rtx (SImode);
1721 rtx index = gen_reg_rtx (SImode);
1722 rtx addr = gen_reg_rtx (Pmode);
1725 emit_move_insn (table, gen_rtx_LABEL_REF (VOIDmode, operands[3]));
1726 emit_move_insn (index, plus_constant (operands[0], - INTVAL (operands[1])));
1727 test = gen_rtx_fmt_ee (GTU, VOIDmode, index, operands[2]);
1728 emit_jump_insn (gen_cbranchsi4 (test, index, operands[2], operands[4]));
1730 emit_move_insn (index, gen_rtx_ASHIFT (SImode, index, const2_rtx));
1731 emit_move_insn (addr, gen_rtx_MEM (SImode,
1732 gen_rtx_PLUS (SImode, table, index)));
1734 emit_move_insn (addr, gen_rtx_PLUS (SImode, addr, table));
1736 emit_jump_insn (gen_tablejump (addr, operands[3]));
1740 (define_insn "tablejump"
1741 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
1742 (use (label_ref (match_operand 1 "" "")))]
1745 [(set_attr "cc" "none")])
1747 ;; Call subroutine with no return value.
1749 (define_expand "call"
1750 [(call (match_operand:QI 0 "general_operand" "")
1751 (match_operand:SI 1 "general_operand" ""))]
1755 if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
1757 if (MN10300_GLOBAL_P (XEXP (operands[0], 0)))
1759 /* The PLT code won't run on AM30, but then, there's no
1760 shared library support for AM30 either, so we just assume
1761 the linker is going to adjust all @PLT relocs to the
1763 emit_use (pic_offset_table_rtx);
1764 XEXP (operands[0], 0) = gen_sym2PLT (XEXP (operands[0], 0));
1767 XEXP (operands[0], 0) = gen_sym2PIC (XEXP (operands[0], 0));
1769 if (! call_address_operand (XEXP (operands[0], 0), VOIDmode))
1770 XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0));
1771 emit_call_insn (gen_call_internal (XEXP (operands[0], 0), operands[1]));
1775 ;; NB: Mode on match_operand 0 deliberately omitted in
1776 ;; order to be able to match UNSPECs in PIC mode.
1777 (define_insn "call_internal"
1778 [(call (mem:QI (match_operand 0 "call_address_operand" "aS"))
1779 (match_operand:SI 1 "general_operand" "g"))]
1783 if (REG_P (operands[0]))
1784 return \"calls %C0\";
1786 return \"call %C0,[],0\";
1788 [(set_attr "cc" "clobber")])
1790 ;; Call subroutine, returning value in operand 0
1791 ;; (which must be a hard register).
1793 (define_expand "call_value"
1794 [(set (match_operand 0 "" "")
1795 (call (match_operand:QI 1 "general_operand" "")
1796 (match_operand:SI 2 "general_operand" "")))]
1800 if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
1802 if (MN10300_GLOBAL_P (XEXP (operands[1], 0)))
1804 /* The PLT code won't run on AM30, but then, there's no
1805 shared library support for AM30 either, so we just assume
1806 the linker is going to adjust all @PLT relocs to the
1808 emit_use (pic_offset_table_rtx);
1809 XEXP (operands[1], 0) = gen_sym2PLT (XEXP (operands[1], 0));
1812 XEXP (operands[1], 0) = gen_sym2PIC (XEXP (operands[1], 0));
1814 if (! call_address_operand (XEXP (operands[1], 0), VOIDmode))
1815 XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0));
1816 emit_call_insn (gen_call_value_internal (operands[0],
1817 XEXP (operands[1], 0),
1822 ;; NB: Mode on match_operands 0 and 1 deliberately omitted
1823 ;; in order to be able to match UNSPECs in PIC mode.
1824 (define_insn "call_value_internal"
1825 [(set (match_operand 0 "register_operand" "=dax")
1826 (call (mem:QI (match_operand 1 "call_address_operand" "aS"))
1827 (match_operand:SI 2 "general_operand" "g")))]
1831 if (REG_P (operands[1]))
1832 return \"calls %C1\";
1834 return \"call %C1,[],0\";
1836 [(set_attr "cc" "clobber")])
1838 (define_expand "untyped_call"
1839 [(parallel [(call (match_operand 0 "" "")
1841 (match_operand 1 "" "")
1842 (match_operand 2 "" "")])]
1848 emit_call_insn (gen_call (operands[0], const0_rtx));
1850 for (i = 0; i < XVECLEN (operands[2], 0); i++)
1852 rtx set = XVECEXP (operands[2], 0, i);
1853 emit_move_insn (SET_DEST (set), SET_SRC (set));
1862 [(set_attr "cc" "none")])
1864 ;; ----------------------------------------------------------------------
1865 ;; EXTEND INSTRUCTIONS
1866 ;; ----------------------------------------------------------------------
1868 (define_expand "zero_extendqisi2"
1869 [(set (match_operand:SI 0 "general_operand" "")
1871 (match_operand:QI 1 "general_operand" "")))]
1876 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx,dx,!dax,!dax,!dax")
1878 (match_operand:QI 1 "general_operand" "0,dax,m,0,dax,m")))]
1887 [(set_attr "cc" "none_0hit")])
1890 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx,dx")
1892 (match_operand:QI 1 "general_operand" "0,d,m")))]
1898 [(set_attr "cc" "none_0hit")])
1900 (define_expand "zero_extendhisi2"
1901 [(set (match_operand:SI 0 "general_operand" "")
1903 (match_operand:HI 1 "general_operand" "")))]
1908 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx,dx,!dax,!dax,!dax")
1910 (match_operand:HI 1 "general_operand" "0,dax,m,0,dax,m")))]
1919 [(set_attr "cc" "none_0hit")])
1922 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx,dx")
1924 (match_operand:HI 1 "general_operand" "0,dx,m")))]
1930 [(set_attr "cc" "none_0hit")])
1932 ;;- sign extension instructions
1934 (define_expand "extendqisi2"
1935 [(set (match_operand:SI 0 "general_operand" "")
1937 (match_operand:QI 1 "general_operand" "")))]
1942 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx,!dax,!dax")
1944 (match_operand:QI 1 "general_operand" "0,dx,0,dax")))]
1951 [(set_attr "cc" "none_0hit")])
1954 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx")
1956 (match_operand:QI 1 "general_operand" "0,dx")))]
1961 [(set_attr "cc" "none_0hit")])
1963 (define_expand "extendhisi2"
1964 [(set (match_operand:SI 0 "general_operand" "")
1966 (match_operand:HI 1 "general_operand" "")))]
1971 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx,!dax,!dax")
1973 (match_operand:HI 1 "general_operand" "0,dax,0,dax")))]
1980 [(set_attr "cc" "none_0hit")])
1983 [(set (match_operand:SI 0 "nonimmediate_operand" "=dx,dx")
1985 (match_operand:HI 1 "general_operand" "0,dx")))]
1990 [(set_attr "cc" "none_0hit")])
1992 ;; ----------------------------------------------------------------------
1994 ;; ----------------------------------------------------------------------
1996 (define_expand "ashlsi3"
1997 [(set (match_operand:SI 0 "register_operand" "")
1999 (match_operand:SI 1 "register_operand" "")
2000 (match_operand:QI 2 "nonmemory_operand" "")))]
2005 [(set (match_operand:SI 0 "register_operand" "=dax,dx,!dax")
2007 (match_operand:SI 1 "register_operand" "0,0,dax")
2008 (match_operand:QI 2 "nonmemory_operand" "J,dxi,dax")))]
2012 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 1)
2013 return \"add %0,%0\";
2015 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 2)
2018 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 3
2019 && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS)
2020 return \"asl2 %0\;add %0,%0\";
2022 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 4
2023 && REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS)
2024 return \"asl2 %0\;asl2 %0\";
2026 if (true_regnum (operands[1]) == true_regnum (operands[0]))
2027 return \"asl %S2,%0\";
2029 if (REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS
2030 && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS
2031 && true_regnum (operands[0]) != true_regnum (operands[2]))
2032 return \"mov %1,%0\;asl %S2,%0\";
2033 return \"asl %2,%1,%0\";
2035 [(set_attr "cc" "set_zn")])
2038 [(set (match_operand:SI 0 "register_operand" "=dax,dx,dx,dx,dx")
2040 (match_operand:SI 1 "register_operand" "0,0,0,0,0")
2041 (match_operand:QI 2 "nonmemory_operand" "J,K,M,L,dxi")))]
2049 [(set_attr "cc" "set_zn")])
2051 (define_expand "lshrsi3"
2052 [(set (match_operand:SI 0 "register_operand" "")
2054 (match_operand:SI 1 "register_operand" "")
2055 (match_operand:QI 2 "nonmemory_operand" "")))]
2060 [(set (match_operand:SI 0 "register_operand" "=dx,!dax")
2062 (match_operand:SI 1 "register_operand" "0,dax")
2063 (match_operand:QI 2 "nonmemory_operand" "dxi,dax")))]
2067 if (true_regnum (operands[1]) == true_regnum (operands[0]))
2068 return \"lsr %S2,%0\";
2070 if (REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS
2071 && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS
2072 && true_regnum (operands[0]) != true_regnum (operands[2]))
2073 return \"mov %1,%0\;lsr %S2,%0\";
2074 return \"lsr %2,%1,%0\";
2076 [(set_attr "cc" "set_zn")])
2079 [(set (match_operand:SI 0 "register_operand" "=dx")
2081 (match_operand:SI 1 "register_operand" "0")
2082 (match_operand:QI 2 "nonmemory_operand" "dxi")))]
2085 [(set_attr "cc" "set_zn")])
2087 (define_expand "ashrsi3"
2088 [(set (match_operand:SI 0 "register_operand" "")
2090 (match_operand:SI 1 "register_operand" "")
2091 (match_operand:QI 2 "nonmemory_operand" "")))]
2096 [(set (match_operand:SI 0 "register_operand" "=dx,!dax")
2098 (match_operand:SI 1 "register_operand" "0,dax")
2099 (match_operand:QI 2 "nonmemory_operand" "dxi,dax")))]
2103 if (true_regnum (operands[1]) == true_regnum (operands[0]))
2104 return \"asr %S2,%0\";
2106 if (REGNO_REG_CLASS (true_regnum (operands[0])) == DATA_REGS
2107 && REGNO_REG_CLASS (true_regnum (operands[1])) == DATA_REGS
2108 && true_regnum (operands[0]) != true_regnum (operands[2]))
2109 return \"mov %1,%0\;asr %S2,%0\";
2110 return \"asr %2,%1,%0\";
2112 [(set_attr "cc" "set_zn")])
2115 [(set (match_operand:SI 0 "register_operand" "=dx")
2117 (match_operand:SI 1 "register_operand" "0")
2118 (match_operand:QI 2 "nonmemory_operand" "dxi")))]
2121 [(set_attr "cc" "set_zn")])
2123 ;; ----------------------------------------------------------------------
2125 ;; ----------------------------------------------------------------------
2127 ;; The mn103 series does not have floating point instructions, but since
2128 ;; FP values are held in integer regs, we can clear the high bit easily
2129 ;; which gives us an efficient inline floating point absolute value.
2131 ;; Similarly for negation of a FP value.
2134 (define_expand "absdf2"
2135 [(set (match_operand:DF 0 "register_operand" "")
2136 (abs:DF (match_operand:DF 1 "register_operand" "")))]
2140 rtx target, result, insns;
2143 target = operand_subword (operands[0], 1, 1, DFmode);
2144 result = expand_binop (SImode, and_optab,
2145 operand_subword_force (operands[1], 1, DFmode),
2146 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
2148 gcc_assert (result);
2150 if (result != target)
2151 emit_move_insn (result, target);
2153 emit_move_insn (operand_subword (operands[0], 0, 1, DFmode),
2154 operand_subword_force (operands[1], 0, DFmode));
2156 insns = get_insns ();
2163 (define_expand "abssf2"
2164 [(set (match_operand:SF 0 "register_operand" "")
2165 (abs:SF (match_operand:SF 1 "register_operand" "")))]
2174 emit_insn (gen_abssf2_am33_2 (operands[0], operands[1]));
2178 target = operand_subword_force (operands[0], 0, SFmode);
2179 result = expand_binop (SImode, and_optab,
2180 operand_subword_force (operands[1], 0, SFmode),
2181 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
2182 gcc_assert (result);
2184 if (result != target)
2185 emit_move_insn (result, target);
2187 /* Make a place for REG_EQUAL. */
2188 emit_move_insn (operands[0], operands[0]);
2193 (define_insn "abssf2_am33_2"
2194 [(set (match_operand:SF 0 "register_operand" "=f,f")
2195 (abs:SF (match_operand:SF 1 "register_operand" "0,?f")))]
2200 [(set_attr "cc" "none_0hit")])
2202 (define_expand "negdf2"
2203 [(set (match_operand:DF 0 "register_operand" "")
2204 (neg:DF (match_operand:DF 1 "register_operand" "")))]
2208 rtx target, result, insns;
2211 target = operand_subword (operands[0], 1, 1, DFmode);
2212 result = expand_binop (SImode, xor_optab,
2213 operand_subword_force (operands[1], 1, DFmode),
2214 GEN_INT (trunc_int_for_mode (0x80000000, SImode)),
2215 target, 0, OPTAB_WIDEN);
2217 gcc_assert (result);
2219 if (result != target)
2220 emit_move_insn (result, target);
2222 emit_move_insn (operand_subword (operands[0], 0, 1, DFmode),
2223 operand_subword_force (operands[1], 0, DFmode));
2225 insns = get_insns ();
2232 (define_expand "negsf2"
2233 [(set (match_operand:SF 0 "register_operand" "")
2234 (neg:SF (match_operand:SF 1 "register_operand" "")))]
2243 emit_insn (gen_negsf2_am33_2 (operands[0], operands[1]));
2247 target = operand_subword_force (operands[0], 0, SFmode);
2248 result = expand_binop (SImode, xor_optab,
2249 operand_subword_force (operands[1], 0, SFmode),
2250 GEN_INT (trunc_int_for_mode (0x80000000, SImode)),
2251 target, 0, OPTAB_WIDEN);
2252 gcc_assert (result);
2254 if (result != target)
2255 emit_move_insn (result, target);
2257 /* Make a place for REG_EQUAL. */
2258 emit_move_insn (operands[0], operands[0]);
2262 (define_insn "negsf2_am33_2"
2263 [(set (match_operand:SF 0 "register_operand" "=f,f")
2264 (neg:SF (match_operand:SF 1 "register_operand" "0,?f")))]
2269 [(set_attr "cc" "none_0hit")])
2271 (define_expand "sqrtsf2"
2272 [(set (match_operand:SF 0 "register_operand" "")
2273 (sqrt:SF (match_operand:SF 1 "register_operand" "")))]
2274 "TARGET_AM33_2 && flag_unsafe_math_optimizations"
2277 rtx scratch = gen_reg_rtx (SFmode);
2278 emit_insn (gen_rsqrtsf2 (scratch, operands[1], CONST1_RTX (SFmode)));
2279 emit_insn (gen_divsf3 (operands[0], force_reg (SFmode, CONST1_RTX (SFmode)),
2284 (define_insn "rsqrtsf2"
2285 [(set (match_operand:SF 0 "register_operand" "=f,f")
2286 (div:SF (match_operand:SF 2 "const_1f_operand" "F,F")
2287 (sqrt:SF (match_operand:SF 1 "register_operand" "0,?f"))))]
2292 [(set_attr "cc" "none_0hit")])
2294 (define_insn "addsf3"
2295 [(set (match_operand:SF 0 "register_operand" "=f,f")
2296 (plus:SF (match_operand:SF 1 "register_operand" "%0,f")
2297 (match_operand:SF 2 "general_operand" "f,?fF")))]
2302 [(set_attr "cc" "none_0hit")])
2304 (define_insn "subsf3"
2305 [(set (match_operand:SF 0 "register_operand" "=f,f")
2306 (minus:SF (match_operand:SF 1 "register_operand" "0,f")
2307 (match_operand:SF 2 "general_operand" "f,?fF")))]
2312 [(set_attr "cc" "none_0hit")])
2314 (define_insn "mulsf3"
2315 [(set (match_operand:SF 0 "register_operand" "=f,f")
2316 (mult:SF (match_operand:SF 1 "register_operand" "%0,f")
2317 (match_operand:SF 2 "general_operand" "f,?fF")))]
2322 [(set_attr "cc" "none_0hit")])
2324 (define_insn "divsf3"
2325 [(set (match_operand:SF 0 "register_operand" "=f,f")
2326 (div:SF (match_operand:SF 1 "register_operand" "0,f")
2327 (match_operand:SF 2 "general_operand" "f,?fF")))]
2332 [(set_attr "cc" "none_0hit")])
2334 (define_insn "fmaddsf4"
2335 [(set (match_operand:SF 0 "register_operand" "=A")
2336 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f")
2337 (match_operand:SF 2 "register_operand" "f"))
2338 (match_operand:SF 3 "register_operand" "f")))]
2340 "fmadd %1, %2, %3, %0"
2341 [(set_attr "cc" "none_0hit")])
2343 (define_insn "fmsubsf4"
2344 [(set (match_operand:SF 0 "register_operand" "=A")
2345 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f")
2346 (match_operand:SF 2 "register_operand" "f"))
2347 (match_operand:SF 3 "register_operand" "f")))]
2349 "fmsub %1, %2, %3, %0"
2350 [(set_attr "cc" "none_0hit")])
2352 (define_insn "fnmaddsf4"
2353 [(set (match_operand:SF 0 "register_operand" "=A")
2354 (minus:SF (match_operand:SF 3 "register_operand" "f")
2355 (mult:SF (match_operand:SF 1 "register_operand" "%f")
2356 (match_operand:SF 2 "register_operand" "f"))))]
2358 "fnmadd %1, %2, %3, %0"
2359 [(set_attr "cc" "none_0hit")])
2361 (define_insn "fnmsubsf4"
2362 [(set (match_operand:SF 0 "register_operand" "=A")
2363 (minus:SF (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "%f")
2364 (match_operand:SF 2 "register_operand" "f")))
2365 (match_operand:SF 3 "register_operand" "f")))]
2367 "fnmsub %1, %2, %3, %0"
2368 [(set_attr "cc" "none_0hit")])
2371 ;; ----------------------------------------------------------------------
2372 ;; PROLOGUE/EPILOGUE
2373 ;; ----------------------------------------------------------------------
2374 (define_expand "prologue"
2377 "expand_prologue (); DONE;")
2379 (define_expand "epilogue"
2388 (define_insn "return_internal"
2393 [(set_attr "cc" "clobber")])
2395 ;; This insn restores the callee saved registers and does a return, it
2396 ;; can also deallocate stack space.
2397 (define_insn "return_internal_regs"
2399 (match_operand:SI 0 "const_int_operand" "i")
2404 fputs (\"\\tret \", asm_out_file);
2405 mn10300_print_reg_list (asm_out_file, mn10300_get_live_callee_saved_regs ());
2406 fprintf (asm_out_file, \",%d\\n\", (int) INTVAL (operands[0]));
2409 [(set_attr "cc" "clobber")])
2411 ;; This instruction matches one generated by mn10300_gen_multiple_store()
2412 (define_insn "store_movm"
2413 [(match_parallel 0 "store_multiple_operation"
2414 [(set (reg:SI 9) (plus:SI (reg:SI 9) (match_operand 1 "" "")))])]
2418 fputs (\"\\tmovm \", asm_out_file);
2419 mn10300_print_reg_list (asm_out_file,
2420 store_multiple_operation (operands[0], VOIDmode));
2421 fprintf (asm_out_file, \",(sp)\\n\");
2424 [(set_attr "cc" "clobber")])
2426 (define_insn "return"
2428 "can_use_return_insn ()"
2431 rtx next = next_active_insn (insn);
2434 && GET_CODE (next) == JUMP_INSN
2435 && GET_CODE (PATTERN (next)) == RETURN)
2440 [(set_attr "cc" "clobber")])
2442 ;; Try to combine consecutive updates of the stack pointer (or any
2443 ;; other register for that matter).
2445 [(set (match_operand:SI 0 "register_operand" "=dxay")
2446 (plus:SI (match_dup 0)
2447 (match_operand 1 "const_int_operand" "")))
2449 (plus:SI (match_dup 0)
2450 (match_operand 2 "const_int_operand" "")))]
2454 operands[1] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[1]));
2455 return \"add %1,%0\";
2457 [(set_attr "cc" "clobber")])
2460 ;; We had patterns to check eq/ne, but the they don't work because
2461 ;; 0x80000000 + 0x80000000 = 0x0 with a carry out.
2463 ;; The Z flag and C flag would be set, and we have no way to
2464 ;; check for the Z flag set and C flag clear.
2466 ;; This will work on the mn10200 because we can check the ZX flag
2467 ;; if the comparison is in HImode.
2469 [(set (cc0) (compare (match_operand:SI 0 "register_operand" "dx")
2471 (set (pc) (if_then_else (ge (cc0) (const_int 0))
2472 (match_operand 1 "" "")
2474 "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
2476 [(set_attr "cc" "clobber")])
2479 [(set (cc0) (compare (match_operand:SI 0 "register_operand" "dx")
2481 (set (pc) (if_then_else (lt (cc0) (const_int 0))
2482 (match_operand 1 "" "")
2484 "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
2486 [(set_attr "cc" "clobber")])
2489 [(set (cc0) (compare (match_operand:SI 0 "register_operand" "dx")
2491 (set (pc) (if_then_else (ge (cc0) (const_int 0))
2493 (match_operand 1 "" "")))]
2494 "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
2496 [(set_attr "cc" "clobber")])
2499 [(set (cc0) (compare (match_operand:SI 0 "register_operand" "dx")
2501 (set (pc) (if_then_else (lt (cc0) (const_int 0))
2503 (match_operand 1 "" "")))]
2504 "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
2506 [(set_attr "cc" "clobber")])
2508 (define_expand "int_label"
2509 [(unspec [(match_operand:SI 0 "" "")] UNSPEC_INT_LABEL)]
2512 (define_expand "GOTaddr2picreg"
2516 /* It would be nice to be able to have int_label keep track of the
2517 counter and all, but if we add C code to it, we'll get an insn
2518 back, and we just want the pattern. */
2519 operands[0] = gen_int_label (GEN_INT (mn10300_unspec_int_label_counter++));
2521 emit_insn (gen_am33_loadPC (operands[0]));
2523 emit_insn (gen_mn10300_loadPC (operands[0]));
2524 emit_insn (gen_add_GOT_to_pic_reg (copy_rtx (operands[0])));
2529 (define_insn "am33_loadPC"
2531 [(set (reg:SI PIC_REG) (pc))
2532 (use (match_operand 0 "" ""))])]
2537 (define_insn_and_split "mn10300_loadPC"
2539 [(set (reg:SI PIC_REG) (pc))
2540 (use (match_operand 0 "" ""))])]
2544 [(match_operand 0 "" "")]
2547 rtx sp_reg = gen_rtx_REG (SImode, SP_REG);
2548 int need_stack_space = (get_frame_size () == 0
2549 && crtl->outgoing_args_size == 0);
2551 if (need_stack_space)
2552 emit_move_insn (sp_reg, plus_constant (sp_reg, -4));
2554 emit_insn (gen_call_next_insn (operands[0]));
2556 if (need_stack_space)
2557 emit_insn (gen_pop_pic_reg ());
2559 emit_move_insn (pic_offset_table_rtx, gen_rtx_MEM (SImode, sp_reg));
2564 (define_insn "call_next_insn"
2566 [(set (mem:SI (reg:SI SP_REG)) (pc))
2567 (use (match_operand 0 "" ""))])]
2571 (define_expand "add_GOT_to_pic_reg"
2572 [(set (reg:SI PIC_REG)
2576 (unspec:SI [(match_operand:SI 0 "" "")] UNSPEC_GOTSYM_OFF))))]
2579 (define_expand "symGOT2reg"
2580 [(match_operand:SI 0 "" "")
2581 (match_operand:SI 1 "" "")]
2585 rtx insn = emit_insn (gen_symGOT2reg_i (operands[0], operands[1]));
2587 MEM_READONLY_P (SET_SRC (PATTERN (insn))) = 1;
2589 set_unique_reg_note (insn, REG_EQUAL, operands[1]);
2594 (define_expand "symGOT2reg_i"
2595 [(set (match_operand:SI 0 "" "")
2596 (mem:SI (plus:SI (reg:SI PIC_REG)
2597 (const (unspec [(match_operand:SI 1 "" "")]
2602 (define_expand "symGOTOFF2reg"
2603 [(match_operand:SI 0 "" "") (match_operand:SI 1 "" "")]
2607 rtx insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1]));
2609 set_unique_reg_note (insn, REG_EQUAL, operands[1]);
2614 (define_expand "symGOTOFF2reg_i"
2615 [(set (match_operand:SI 0 "" "")
2616 (const (unspec [(match_operand:SI 1 "" "")] UNSPEC_GOTOFF)))
2617 (set (match_dup 0) (plus:SI (match_dup 0) (reg:SI PIC_REG)))]
2621 (define_expand "sym2PIC"
2622 [(unspec [(match_operand:SI 0 "" "")] UNSPEC_PIC)]
2625 (define_expand "sym2PLT"
2626 [(unspec [(match_operand:SI 0 "" "")] UNSPEC_PLT)]