1;; ---------------------------------------------------------------------- 2;; PROLOGUE/EPILOGUE-RELATED INSTRUCTIONS 3;; ---------------------------------------------------------------------- 4 5(define_expand "push_h8300hs_advanced" 6 [(set (mem:SI (pre_dec:SI (reg:SI SP_REG))) 7 (match_operand:SI 0 "register_operand" ""))] 8 "TARGET_H8300H && TARGET_H8300S && !TARGET_NORMAL_MODE" 9 "") 10 11(define_expand "push_h8300hs_normal" 12 [(set (mem:SI (pre_dec:HI (reg:HI SP_REG))) 13 (match_operand:SI 0 "register_operand" ""))] 14 "TARGET_H8300H && TARGET_H8300S && TARGET_NORMAL_MODE" 15 "") 16 17(define_expand "pop_h8300hs_advanced" 18 [(set (match_operand:SI 0 "register_operand" "") 19 (mem:SI (post_inc:SI (reg:SI SP_REG))))] 20 "TARGET_H8300H && TARGET_H8300S && !TARGET_NORMAL_MODE" 21 "") 22 23(define_expand "pop_h8300hs_normal" 24 [(set (match_operand:SI 0 "register_operand" "") 25 (mem:SI (post_inc:HI (reg:HI SP_REG))))] 26 "TARGET_H8300H && TARGET_H8300S && TARGET_NORMAL_MODE" 27 "") 28 29(define_insn "ldm_h8300sx" 30 [(match_parallel 0 "h8300_ldm_parallel" 31 [(set (match_operand:SI 1 "register_operand" "") 32 (match_operand:SI 2 "memory_operand" ""))])] 33 "TARGET_H8300S" 34{ 35 operands[3] = SET_DEST (XVECEXP (operands[0], 0, 36 XVECLEN (operands[0], 0) - 2)); 37 return "ldm.l\t@er7+,%S1-%S3"; 38} 39 [(set_attr "length" "4")]) 40 41(define_insn "stm_h8300sx" 42 [(match_parallel 0 "h8300_stm_parallel" 43 [(set (match_operand:SI 1 "memory_operand" "") 44 (match_operand:SI 2 "register_operand" ""))])] 45 "TARGET_H8300S" 46{ 47 operands[3] = SET_SRC (XVECEXP (operands[0], 0, 48 XVECLEN (operands[0], 0) - 2)); 49 return "stm.l\t%S2-%S3,@-er7"; 50} 51 [(set_attr "length" "4")]) 52 53(define_insn "return_h8sx" 54 [(match_parallel 0 "h8300_return_parallel" 55 [(return) 56 (set (match_operand:SI 1 "register_operand" "") 57 (match_operand:SI 2 "memory_operand" ""))])] 58 "TARGET_H8300SX" 59{ 60 operands[3] = SET_DEST (XVECEXP (operands[0], 0, 61 XVECLEN (operands[0], 0) - 2)); 62 if (h8300_current_function_interrupt_function_p () 63 || h8300_current_function_monitor_function_p ()) 64 return "rte/l\t%S1-%S3"; 65 else 66 return "rts/l\t%S1-%S3"; 67} 68 [(set_attr "can_delay" "no") 69 (set_attr "length" "2")]) 70 71(define_expand "return" 72 [(return)] 73 "h8300_can_use_return_insn_p ()" 74 "") 75 76(define_insn "*return_1" 77 [(return)] 78 "reload_completed" 79{ 80 if (h8300_current_function_interrupt_function_p () 81 || h8300_current_function_monitor_function_p ()) 82 return "rte"; 83 else 84 return "rts"; 85} 86 [(set_attr "can_delay" "no") 87 (set_attr "length" "2")]) 88 89(define_expand "prologue" 90 [(const_int 0)] 91 "" 92 { 93 h8300_expand_prologue (); 94 DONE; 95 }) 96 97(define_expand "epilogue" 98 [(return)] 99 "" 100 { 101 h8300_expand_epilogue (false); 102 DONE; 103 }) 104 105(define_insn "monitor_prologue" 106 [(unspec_volatile [(const_int 0)] UNSPEC_MONITOR)] 107 "" 108{ 109 if (TARGET_H8300H && TARGET_NORMAL_MODE) 110 return "subs\\t#2,er7\;mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr"; 111 else if (TARGET_H8300H) 112 return "mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr"; 113 else if (TARGET_H8300S && TARGET_NEXR ) 114 return "mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr"; 115 else if (TARGET_H8300S && TARGET_NEXR && TARGET_NORMAL_MODE) 116 return "subs\\t#2,er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr"; 117 else if (TARGET_H8300S && TARGET_NORMAL_MODE) 118 return "subs\\t#2,er7\;stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr"; 119 else if (TARGET_H8300S) 120 return "stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr"; 121 gcc_unreachable (); 122} 123 [(set_attr "length" "20")]) 124 125(define_expand "sibcall_epilogue" 126 [(const_int 0)] 127 "" 128 { 129 h8300_expand_epilogue (true); 130 DONE; 131 }) 132