1 From 09463827001a7b8094f4b9460514370a1876d908 Mon Sep 17 00:00:00 2001
2 From: Claudiu Zissulescu <claziss@synopsys.com>
3 Date: Wed, 20 Jan 2016 16:32:40 +0100
4 Subject: [PATCH] Don't allow mcompact-casesi for ARCv2
6 The compact casesi is not working for arcv2 processors family as it
7 makes use of the add_s rx,rx,pcl instruction which is only valid for
8 arc6xx and arc700 processors. Also not having this instruction makes
9 no much sens to change the compact-casesi pattern to use normal add
10 instructions as it nullifies the advantage of short instruction use.
11 The default casesi pattern betters suits the arcv2 architecture.
13 The fix is done in development tree: [arc-4.8-dev 0946382]
14 and will be a part of the next release of ARC GNU tools.
15 Once that new release happens this patch must be removed.
18 2016-01-20 Claudiu Zissulescu <claziss@synopsys.com>
20 * common/config/arc/arc-common.c (arc_option_optimization_table):
21 Remove mcompact-casesi option.
22 * config/arc/arc.c (arc_override_options): Use compact-casesi only
24 * config/arc/arc.md (casesi_load): Use short instructions.
26 gcc/common/config/arc/arc-common.c | 1 -
27 gcc/config/arc/arc.c | 9 +++++----
28 gcc/config/arc/arc.md | 10 ++++++++--
29 3 files changed, 13 insertions(+), 7 deletions(-)
31 * config/arc/arc.c (arc_legitimize_pic_address): Handle MINUS
32 diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
33 index e2e36fa..310bc80 100644
34 --- a/gcc/common/config/arc/arc-common.c
35 +++ b/gcc/common/config/arc/arc-common.c
36 @@ -58,7 +58,6 @@ static const struct default_options arc_option_optimization_table[] =
37 { OPT_LEVELS_ALL, OPT_mbbit_peephole, NULL, 1 },
38 { OPT_LEVELS_SIZE, OPT_mq_class, NULL, 1 },
39 { OPT_LEVELS_SIZE, OPT_mcase_vector_pcrel, NULL, 1 },
40 - { OPT_LEVELS_SIZE, OPT_mcompact_casesi, NULL, 1 },
41 { OPT_LEVELS_NONE, 0, NULL, 0 }
44 diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
45 index 18d88a3..f828398 100644
46 --- a/gcc/config/arc/arc.c
47 +++ b/gcc/config/arc/arc.c
48 @@ -1151,6 +1151,11 @@ arc_override_options (void)
49 if (arc_size_opt_level == 3)
53 + TARGET_COMPACT_CASESI = 0;
54 + else if (optimize_size == 1)
55 + TARGET_COMPACT_CASESI = 1;
58 target_flags |= MASK_NO_SDATA_SET;
60 @@ -1163,10 +1168,6 @@ arc_override_options (void)
62 TARGET_COMPACT_CASESI = 0;
64 - /* For the time being don't support COMPACT_CASESI for ARCv2. */
66 - TARGET_COMPACT_CASESI = 0;
68 if (TARGET_COMPACT_CASESI)
69 TARGET_CASE_VECTOR_PC_RELATIVE = 1;
71 diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
72 index bc4ac38..ba7c8bc 100644
73 --- a/gcc/config/arc/arc.md
74 +++ b/gcc/config/arc/arc.md
75 @@ -3837,14 +3837,20 @@
76 switch (GET_MODE (diff_vec))
79 - return \"ld.as %0,[%1,%2]%&\";
80 + if ((which_alternative == 0) && TARGET_CODE_DENSITY)
81 + return \"ld_s.as %0,[%1,%2]%&\";
83 + return \"ld.as %0,[%1,%2]%&\";
85 if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
86 return \"ldw.as %0,[%1,%2]\";
87 return \"ldw.x.as %0,[%1,%2]\";
89 if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
90 - return \"ldb%? %0,[%1,%2]%&\";
91 + if (which_alternative == 0)
92 + return \"ldb_s %0,[%1,%2]%&\";
94 + return \"ldb %0,[%1,%2]%&\";
95 return \"ldb.x %0,[%1,%2]\";