1 Fix length of instructions that are in delay slot and needs to be predicated
3 Following problem was reported:
5 arceb-linux-gcc -mq-class -g -O2 -c -o main.o main.i
6 /tmp/ccudUc8y.s: Assembler messages:
7 /tmp/ccudUc8y.s:18820: Error: operand out of range (256 is not between -256 and 255)
10 Fix is taken from current development branch of GCC for ARC and will be a
11 part of the next release of ARC tools, so at that point patch should be dropped.
13 https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/commit/5dfca5504d38293d5264f632c3090ac39c12f72b
15 Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
18 diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
19 index 908d002..212423b 100644
20 --- a/gcc/config/arc/arc-protos.h
21 +++ b/gcc/config/arc/arc-protos.h
22 @@ -126,4 +126,5 @@ extern void arc_expand_compare_and_swap (rtx *);
25 extern void arc_expand_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
26 +extern bool arc_bdr_iscond (rtx);
28 diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
29 index 68e5552..7d3ded3 100644
30 --- a/gcc/config/arc/arc.c
31 +++ b/gcc/config/arc/arc.c
32 @@ -9336,6 +9336,23 @@ arc_write_ext_corereg (rtx insn)
33 return for_each_rtx (&PATTERN (insn), write_ext_corereg_1, 0);
36 +/* Return true if the insn is in a delay slot and needs to be executed
40 +arc_bdr_iscond (rtx insn)
42 + rtx jump = prev_active_insn (insn);
44 + if (!jump || !JUMP_P(jump))
47 + if (INSN_ANNULLED_BRANCH_P (jump) && INSN_FROM_TARGET_P (insn))
53 /* This is like the hook, but returns NULL when it can't / won't generate
54 a legitimate address. */
56 diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
57 index e001659..88b2e37 100644
58 --- a/gcc/config/arc/arc.md
59 +++ b/gcc/config/arc/arc.md
61 (cond [(match_test "GET_CODE (PATTERN (insn)) == COND_EXEC")
64 - (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 4)]
65 + (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC || arc_bdr_iscond (insn)")
69 (eq_attr "iscompact" "true_limm")