Skip to content

Commit 64c9311

Browse files
author
Claudiu Zissulescu
committed
Use reti when returning from an interrupt routine (arcv2 only)
1 parent 0910c1b commit 64c9311

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

gcc/ChangeLog.ARC

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2013-05-27 Claudiu Zissulescu <[email protected]>
2+
3+
* config/arc/arc.md (simple_return): Use RETI when returning
4+
from an interrupt. Valid only for ARCv2.
5+
16
2013-05-22 Claudiu Zissulescu <[email protected]>
27

38
* config/arc/arc.c (arc_conditional_register_usage): Make sure

gcc/config/arc/arc.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177

178178
(define_attr "type"
179179
"move,load,store,cmove,unary,binary,compare,shift,uncond_branch,jump,branch,
180-
brcc,brcc_no_delay_slot,call,sfunc,call_no_delay_slot,
180+
brcc,brcc_no_delay_slot,call,sfunc,call_no_delay_slot,retintr,
181181
multi,umulti, two_cycle_core,lr,sr,divaw,loop_setup,loop_end,return,
182182
misc,spfp,dpfp_mult,dpfp_addsub,mulmac_600,cc_arith,
183183
simd_vload, simd_vload128, simd_vstore, simd_vmove, simd_vmove_else_zero,
@@ -445,7 +445,7 @@
445445

446446
(define_attr "in_delay_slot" "false,true"
447447
(cond [(eq_attr "type" "uncond_branch,jump,branch,
448-
call,sfunc,call_no_delay_slot,
448+
call,sfunc,call_no_delay_slot,retintr,
449449
brcc, brcc_no_delay_slot,loop_setup,loop_end")
450450
(const_string "false")
451451
(match_test "arc_write_ext_corereg (insn)")
@@ -4777,15 +4777,33 @@
47774777
= gen_rtx_REG (Pmode,
47784778
arc_return_address_regs[arc_compute_function_type (cfun)]);
47794779

4780-
if (TARGET_PAD_RETURN)
4781-
arc_pad_return ();
4782-
output_asm_insn (\"j%!%* [%0]%&\", &reg);
4783-
return \"\";
4780+
if (arc_compute_function_type (cfun) == ARC_FUNCTION_ILINK1
4781+
&& TARGET_V2)
4782+
{
4783+
return \"reti\";
4784+
}
4785+
else
4786+
{
4787+
if (TARGET_PAD_RETURN)
4788+
arc_pad_return ();
4789+
output_asm_insn (\"j%!%* [%0]%&\", &reg);
4790+
return \"\";
4791+
}
47844792
}
4785-
[(set_attr "type" "return")
4793+
[(set (attr "type")
4794+
(cond [(and (eq (symbol_ref "arc_compute_function_type (cfun)")
4795+
(symbol_ref "ARC_FUNCTION_ILINK1"))
4796+
(match_test "TARGET_V2"))
4797+
(const_string "retintr")]
4798+
(const_string "return")))
47864799
; predicable won't help here since the canonical rtl looks different
47874800
; for branches.
4788-
(set_attr "cond" "canuse")
4801+
(set (attr "cond")
4802+
(cond [(and (eq (symbol_ref "arc_compute_function_type (cfun)")
4803+
(symbol_ref "ARC_FUNCTION_ILINK1"))
4804+
(match_test "TARGET_V2"))
4805+
(const_string "nocond")]
4806+
(const_string "canuse")))
47894807
(set (attr "iscompact")
47904808
(cond [(eq (symbol_ref "arc_compute_function_type (cfun)")
47914809
(symbol_ref "ARC_FUNCTION_NORMAL"))

0 commit comments

Comments
 (0)