libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / config / h8300 / proepi.md
blobab58d02fc7f08bbead9ce8f6b2088248c22fd905
1 ;; ----------------------------------------------------------------------
2 ;; PROLOGUE/EPILOGUE-RELATED INSTRUCTIONS
3 ;; ----------------------------------------------------------------------
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   "")
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   "")
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   "")
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   "")
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"
35   operands[3] = SET_DEST (XVECEXP (operands[0], 0,
36                                    XVECLEN (operands[0], 0) - 2));
37   return "ldm.l\t@er7+,%S1-%S3";
39   [(set_attr "length" "4")])
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"
47   operands[3] = SET_SRC (XVECEXP (operands[0], 0,
48                                   XVECLEN (operands[0], 0) - 2));
49   return "stm.l\t%S2-%S3,@-er7";
51   [(set_attr "length" "4")])
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"
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";
68   [(set_attr "can_delay" "no")
69    (set_attr "length" "2")])
71 (define_expand "return"
72   [(return)]
73   "h8300_can_use_return_insn_p ()"
74   "")
76 (define_insn "*return_1"
77   [(return)]
78   "reload_completed"
80   if (h8300_current_function_interrupt_function_p ()
81       || h8300_current_function_monitor_function_p ())
82     return "rte";
83   else
84     return "rts";
86   [(set_attr "can_delay" "no")
87    (set_attr "length" "2")])
89 (define_expand "prologue"
90   [(const_int 0)]
91   ""
92   {
93     h8300_expand_prologue ();
94     DONE;
95   })
97 (define_expand "epilogue"
98   [(return)]
99   ""
100   {
101     h8300_expand_epilogue (false);
102     DONE;
103   })
105 (define_insn "monitor_prologue"
106   [(unspec_volatile [(const_int 0)] UNSPEC_MONITOR)]
107   ""
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 ();
123   [(set_attr "length" "20")])
125 (define_expand "sibcall_epilogue"
126   [(const_int 0)]
127   ""
128   {
129     h8300_expand_epilogue (true);
130     DONE;
131   })