summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2017-12-13 16:58:34 -0800
committerManjukumar Matha <manjukumar.harthikote-matha@xilinx.com>2018-01-12 15:47:59 -0800
commit7935ef724cd7359ed97e6ae3d90ebc8f07dd7e1f (patch)
tree7c6faff836ccec34825a97fa7b7c49936e2bc4e2 /meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch
parentfb15f2e401ed07f774ea89e0c91ecd927bf09235 (diff)
downloadmeta-xilinx-7935ef724cd7359ed97e6ae3d90ebc8f07dd7e1f.tar.gz
gcc-source: Add all Xilinx MicroBlaze GCC 7.2 patchesrocko
Add all the Xilinx patches for MicroBlaze, this includes a number of bug fixes, testsuite fixes, feature improvements and additional feature support. Important changes: * v10.0 - CPU support * v10.0 - Bit-field instruction support * v10.0 - 8-stage pipeline aka 'frequency' optimized * Size optimized implementations for shift instructions Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
Diffstat (limited to 'meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch')
-rw-r--r--meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch250
1 files changed, 250 insertions, 0 deletions
diff --git a/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch b/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch
new file mode 100644
index 00000000..c3e4bc9e
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-microblaze/gcc/gcc-7/0029-Fix-bug-in-MB-version-calculation.patch
@@ -0,0 +1,250 @@
1From 3eada9d81437d378ef24f11a8bd046fee5b3505a Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sat, 26 Aug 2017 19:21:49 -0700
4Subject: [PATCH] Fix bug in MB version calculation
5
6This patch fixes the bug in microblaze_version_to_int function. Earlier
7the conversion of vXX.YY.Z to int has a bug which is fixed now.
8
9Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
10Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com>
11Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
12Upstream-Status: Pending
13---
14 gcc/config/microblaze/microblaze.c | 147 ++++++++++++++++++-------------------
15 1 file changed, 70 insertions(+), 77 deletions(-)
16
17diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
18index 2ed64971fb..55dba83882 100644
19--- a/gcc/config/microblaze/microblaze.c
20+++ b/gcc/config/microblaze/microblaze.c
21@@ -239,6 +239,63 @@ section *sdata2_section;
22 #define TARGET_HAVE_TLS true
23 #endif
24
25+/* Convert a version number of the form "vX.YY.Z" to an integer encoding
26+ for easier range comparison. */
27+static int
28+microblaze_version_to_int (const char *version)
29+{
30+ const char *p, *v;
31+ const char *tmpl = "vXX.YY.Z";
32+ int iver1 =0, iver2 =0, iver3 =0;
33+
34+ p = version;
35+ v = tmpl;
36+
37+ while (*p)
38+ {
39+ if (*v == 'X')
40+ { /* Looking for major */
41+ if (*p == '.')
42+ {
43+ *v++;
44+ }
45+ else
46+ {
47+ if (!(*p >= '0' && *p <= '9'))
48+ return -1;
49+ iver1 += (int) (*p - '0');
50+ iver1 *= 1000;
51+ }
52+ }
53+ else if (*v == 'Y')
54+ { /* Looking for minor */
55+ if (!(*p >= '0' && *p <= '9'))
56+ return -1;
57+ iver2 += (int) (*p - '0');
58+ iver2 *= 10;
59+ }
60+ else if (*v == 'Z')
61+ { /* Looking for compat */
62+ if (!(*p >= 'a' && *p <= 'z'))
63+ return -1;
64+ iver3 = ((int) (*p)) - 96;
65+ }
66+ else
67+ {
68+ if (*p != *v)
69+ return -1;
70+ }
71+
72+ v++;
73+ p++;
74+ }
75+
76+ if (*p)
77+ return -1;
78+
79+ return iver1 + iver2 + iver3;
80+}
81+
82 /* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */
83 static bool
84 microblaze_const_double_ok (rtx op, machine_mode mode)
85@@ -1267,8 +1324,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
86 {
87 if (TARGET_BARREL_SHIFT)
88 {
89- if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a")
90- >= 0)
91+ if (microblaze_version_to_int(microblaze_select_cpu) >= microblaze_version_to_int("v5.00.a"))
92 *total = COSTS_N_INSNS (1);
93 else
94 *total = COSTS_N_INSNS (2);
95@@ -1329,8 +1385,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
96 }
97 else if (!TARGET_SOFT_MUL)
98 {
99- if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a")
100- >= 0)
101+ if (microblaze_version_to_int(microblaze_select_cpu) >= microblaze_version_to_int("v5.00.a"))
102 *total = COSTS_N_INSNS (1);
103 else
104 *total = COSTS_N_INSNS (3);
105@@ -1610,72 +1665,13 @@ function_arg_partial_bytes (cumulative_args_t cum_v, machine_mode mode,
106 return 0;
107 }
108
109-/* Convert a version number of the form "vX.YY.Z" to an integer encoding
110- for easier range comparison. */
111-static int
112-microblaze_version_to_int (const char *version)
113-{
114- const char *p, *v;
115- const char *tmpl = "vXX.YY.Z";
116- int iver = 0;
117-
118- p = version;
119- v = tmpl;
120-
121- while (*p)
122- {
123- if (*v == 'X')
124- { /* Looking for major */
125- if (*p == '.')
126- {
127- v++;
128- }
129- else
130- {
131- if (!(*p >= '0' && *p <= '9'))
132- return -1;
133- iver += (int) (*p - '0');
134- iver *= 10;
135- }
136- }
137- else if (*v == 'Y')
138- { /* Looking for minor */
139- if (!(*p >= '0' && *p <= '9'))
140- return -1;
141- iver += (int) (*p - '0');
142- iver *= 10;
143- }
144- else if (*v == 'Z')
145- { /* Looking for compat */
146- if (!(*p >= 'a' && *p <= 'z'))
147- return -1;
148- iver *= 10;
149- iver += (int) (*p - 'a');
150- }
151- else
152- {
153- if (*p != *v)
154- return -1;
155- }
156-
157- v++;
158- p++;
159- }
160-
161- if (*p)
162- return -1;
163-
164- return iver;
165-}
166-
167-
168 static void
169 microblaze_option_override (void)
170 {
171 register int i, start;
172 register int regno;
173 register machine_mode mode;
174- int ver;
175+ int ver,ver_int;
176
177 microblaze_section_threshold = (global_options_set.x_g_switch_value
178 ? g_switch_value
179@@ -1696,13 +1692,13 @@ microblaze_option_override (void)
180 /* Check the MicroBlaze CPU version for any special action to be done. */
181 if (microblaze_select_cpu == NULL)
182 microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU;
183- ver = microblaze_version_to_int (microblaze_select_cpu);
184- if (ver == -1)
185+ ver_int = microblaze_version_to_int (microblaze_select_cpu);
186+ if (ver_int == -1)
187 {
188 error ("%qs is an invalid argument to -mcpu=", microblaze_select_cpu);
189 }
190
191- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v3.00.a");
192+ ver = ver_int - microblaze_version_to_int("v3.00.a");
193 if (ver < 0)
194 {
195 /* No hardware exceptions in earlier versions. So no worries. */
196@@ -1713,8 +1709,7 @@ microblaze_option_override (void)
197 microblaze_pipe = MICROBLAZE_PIPE_3;
198 }
199 else if (ver == 0
200- || (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v4.00.b")
201- == 0))
202+ || (ver_int == microblaze_version_to_int("v4.00.b")))
203 {
204 #if 0
205 microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY);
206@@ -1731,11 +1726,9 @@ microblaze_option_override (void)
207 #endif
208 microblaze_no_unsafe_delay = 0;
209 microblaze_pipe = MICROBLAZE_PIPE_5;
210- if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a") == 0
211- || MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu,
212- "v5.00.b") == 0
213- || MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu,
214- "v5.00.c") == 0)
215+ if ((ver_int == microblaze_version_to_int("v5.00.a"))
216+ || (ver_int == microblaze_version_to_int("v5.00.b"))
217+ || (ver_int == microblaze_version_to_int("v5.00.c")))
218 {
219 /* Pattern compares are to be turned on by default only when
220 compiling for MB v5.00.'z'. */
221@@ -1743,7 +1736,7 @@ microblaze_option_override (void)
222 }
223 }
224
225- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v6.00.a");
226+ ver = ver_int - microblaze_version_to_int("v6.00.a");
227 if (ver < 0)
228 {
229 if (TARGET_MULTIPLY_HIGH)
230@@ -1751,7 +1744,7 @@ microblaze_option_override (void)
231 "-mxl-multiply-high can be used only with -mcpu=v6.00.a or greater");
232 }
233
234- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.10.a");
235+ ver = ver_int - microblaze_version_to_int("v8.10.a");
236 microblaze_has_clz = 1;
237 if (ver < 0)
238 {
239@@ -1760,7 +1753,7 @@ microblaze_option_override (void)
240 }
241
242 /* TARGET_REORDER defaults to 2 if -mxl-reorder not specified. */
243- ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.30.a");
244+ ver = ver_int - microblaze_version_to_int("v8.30.a");
245 if (ver < 0)
246 {
247 if (TARGET_REORDER == 1)
248--
2492.14.2
250