7ceeada7803810b1e914a60c1028d16f150ce3dd
[buildroot.git] /
1 Fix length of instructions that are in delay slot and needs to be predicated
2
3 Following problem was reported:
4 --->---
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)
8 --->---
9
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.
12
13 https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/commit/5dfca5504d38293d5264f632c3090ac39c12f72b
14
15 Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
16 ---
17
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 *);
23
24 #ifdef RTX_CODE
25 extern void arc_expand_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
26 +extern bool arc_bdr_iscond (rtx);
27 #endif
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);
34 }
35
36 +/* Return true if the insn is in a delay slot and needs to be executed
37 + conditionally. */
38 +
39 +bool
40 +arc_bdr_iscond (rtx insn)
41 +{
42 + rtx jump = prev_active_insn (insn);
43 +
44 + if (!jump || !JUMP_P(jump))
45 + return false;
46 +
47 + if (INSN_ANNULLED_BRANCH_P (jump) && INSN_FROM_TARGET_P (insn))
48 + return true;
49 +
50 + return false;
51 +}
52 +
53 /* This is like the hook, but returns NULL when it can't / won't generate
54 a legitimate address. */
55
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
60 @@ -377,7 +377,8 @@
61 (cond [(match_test "GET_CODE (PATTERN (insn)) == COND_EXEC")
62 (const_int 12)]
63 (const_int 10))
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)")
66 + (const_int 4)]
67 (const_int 2))
68
69 (eq_attr "iscompact" "true_limm")