From 05533bcb7e359f4d4fb93b59a868d782f4b8112c Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Fri, 20 Mar 2015 16:45:19 +0100 Subject: [PATCH 1/1] Fix Length attribute --- gcc/config/arc/arc-protos.h | 1 + gcc/config/arc/arc.c | 17 +++++++++++++++++ gcc/config/arc/arc.md | 11 ++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h index ff82ecf..2d99295 100644 --- a/gcc/config/arc/arc-protos.h +++ b/gcc/config/arc/arc-protos.h @@ -118,3 +118,4 @@ extern bool arc_epilogue_uses (int regno); extern int regno_clobbered_p (unsigned int, rtx_insn *, machine_mode, int); extern int arc_return_slot_offset (void); extern bool arc_legitimize_reload_address (rtx *, machine_mode, int, int); +extern bool arc_bdr_iscond (rtx); diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 74089e8..80f36e3 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -8480,6 +8480,23 @@ arc_write_ext_corereg (rtx insn) return 0; } +/* Return true if the insn is in a delay slot and needs to be executed + conditionally. */ + +bool +arc_bdr_iscond (rtx insn) +{ + rtx jump = prev_active_insn (insn); + + if (!jump || !JUMP_P(jump)) + return false; + + if (INSN_ANNULLED_BRANCH_P (jump) && INSN_FROM_TARGET_P (insn)) + return true; + + return false; +} + /* This is like the hook, but returns NULL when it can't / won't generate a legitimate address. */ diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index d66441f..7af1afc 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -334,12 +334,17 @@ (cond [(match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 12)] (const_int 10)) - (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 4)] - (const_int 2)) + (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC || arc_bdr_iscond (insn)") + (const_int 4)] + (const_int 2)) - (eq_attr "iscompact" "true_limm,maybe_limm") + (eq_attr "iscompact" "true_limm") (const_int 6) + (eq_attr "iscompact" "maybe_limm") + (cond [(match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 8)] + (const_int 6)) + (eq_attr "type" "load") (if_then_else (match_operand 1 "long_immediate_loadstore_operand" "") -- 1.7.0.4