Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/gcc/4.3.2/gentoo: 46_all_armel-hilo-union-class.patch 48_all_gfortran-armel-updates.patch
Date: Mon, 26 Jan 2009 03:45:51
Message-Id: E1LRIPz-0006Ws-U8@stork.gentoo.org
1 vapier 09/01/26 03:45:47
2
3 Added: 46_all_armel-hilo-union-class.patch
4 48_all_gfortran-armel-updates.patch
5 Log:
6 grab some fixes from Debian
7
8 Revision Changes Path
9 1.1 src/patchsets/gcc/4.3.2/gentoo/46_all_armel-hilo-union-class.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/gcc/4.3.2/gentoo/46_all_armel-hilo-union-class.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/gcc/4.3.2/gentoo/46_all_armel-hilo-union-class.patch?rev=1.1&content-type=text/plain
13
14 Index: 46_all_armel-hilo-union-class.patch
15 ===================================================================
16 ripped from Debian
17
18 This patch fixes a reload ICE in the Fortran vector_subscript_1.f90
19 test case (as part of the work Andrew Jenner and I have been doing at
20 CodeSourcery to fix ObjC and Fortran for Debian). It's been submitted
21 for comments to gcc-patches@ also:
22
23 http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02033.html
24
25 So, an alternative patch may appear in due course, although this one
26 works fine for the test case in question.
27
28 Cheers,
29
30 Julian
31
32 ChangeLog
33
34 gcc/
35 * config/arm/arm.h (reg_class): Add HILO_REGS class as union of
36 HI_REGS and LO_REGS.
37 (REG_CLASS_NAMES): Likewise.
38 (REG_CLASS_CONTENTS): Likewise.
39 (PREFERRED_RELOAD_CLASS): Prefer LO_REGS for HILO_REGS reloads.
40 * config/arm/arm.md (*thumb1_movsi_insn): Only use
41 for !optimize_size.
42 (*thumb1_movsi_insn_osize): New. Use for optimize_size Thumb-1
43
44 Index: gcc/config/arm/arm.h
45 ===================================================================
46 --- gcc/config/arm/arm.h (revision 206057)
47 +++ gcc/config/arm/arm.h (working copy)
48 @@ -1107,6 +1107,7 @@ enum reg_class
49 STACK_REG,
50 BASE_REGS,
51 HI_REGS,
52 + HILO_REGS,
53 CC_REG,
54 VFPCC_REG,
55 GENERAL_REGS,
56 @@ -1132,6 +1133,7 @@ enum reg_class
57 "STACK_REG", \
58 "BASE_REGS", \
59 "HI_REGS", \
60 + "HILO_REGS", \
61 "CC_REG", \
62 "VFPCC_REG", \
63 "GENERAL_REGS", \
64 @@ -1156,6 +1158,7 @@ enum reg_class
65 { 0x00002000, 0x00000000, 0x00000000, 0x00000000 }, /* STACK_REG */ \
66 { 0x000020FF, 0x00000000, 0x00000000, 0x00000000 }, /* BASE_REGS */ \
67 { 0x0000FF00, 0x00000000, 0x00000000, 0x00000000 }, /* HI_REGS */ \
68 + { 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000 }, /* HILO_REGS */ \
69 { 0x01000000, 0x00000000, 0x00000000, 0x00000000 }, /* CC_REG */ \
70 { 0x00000000, 0x00000000, 0x00000000, 0x80000000 }, /* VFPCC_REG */ \
71 { 0x0200FFFF, 0x00000000, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \
72 @@ -1217,7 +1220,8 @@ enum reg_class
73 #define PREFERRED_RELOAD_CLASS(X, CLASS) \
74 (TARGET_ARM ? (CLASS) : \
75 ((CLASS) == GENERAL_REGS || (CLASS) == HI_REGS \
76 - || (CLASS) == NO_REGS ? LO_REGS : (CLASS)))
77 + || (CLASS) == HILO_REGS || (CLASS) == NO_REGS \
78 + ? LO_REGS : (CLASS)))
79
80 /* Must leave BASE_REGS reloads alone */
81 #define THUMB_SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
82 Index: gcc/config/arm/arm.md
83 ===================================================================
84 --- gcc/config/arm/arm.md (revision 206057)
85 +++ gcc/config/arm/arm.md (working copy)
86 @@ -4823,7 +4823,30 @@
87 (match_operand:SI 1 "general_operand" "l, I,J,K,>,l,mi,l,*lh"))]
88 "TARGET_THUMB1
89 && ( register_operand (operands[0], SImode)
90 - || register_operand (operands[1], SImode))"
91 + || register_operand (operands[1], SImode))
92 + && !optimize_size"
93 + "@
94 + mov %0, %1
95 + mov %0, %1
96 + #
97 + #
98 + ldmia\\t%1, {%0}
99 + stmia\\t%0, {%1}
100 + ldr\\t%0, %1
101 + str\\t%1, %0
102 + mov\\t%0, %1"
103 + [(set_attr "length" "2,2,4,4,2,2,2,2,2")
104 + (set_attr "type" "*,*,*,*,load1,store1,load1,store1,*")
105 + (set_attr "pool_range" "*,*,*,*,*,*,1020,*,*")]
106 +)
107 +
108 +(define_insn "*thumb1_movsi_insn_osize"
109 + [(set (match_operand:SI 0 "nonimmediate_operand" "=l,l,l,l,l,>,l, m,*l*h")
110 + (match_operand:SI 1 "general_operand" "l, I,J,K,>,l,mi,l,*l*h"))]
111 + "TARGET_THUMB1
112 + && ( register_operand (operands[0], SImode)
113 + || register_operand (operands[1], SImode))
114 + && optimize_size"
115 "@
116 mov %0, %1
117 mov %0, %1
118
119
120
121 1.1 src/patchsets/gcc/4.3.2/gentoo/48_all_gfortran-armel-updates.patch
122
123 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/gcc/4.3.2/gentoo/48_all_gfortran-armel-updates.patch?rev=1.1&view=markup
124 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/gcc/4.3.2/gentoo/48_all_gfortran-armel-updates.patch?rev=1.1&content-type=text/plain
125
126 Index: 48_all_gfortran-armel-updates.patch
127 ===================================================================
128 ripped from Debian
129
130 ARM EABI (armel) Fortran support patches
131
132 ChangeLog (enum-size-warning)
133
134 gcc/testsuite/
135 * gfortran.dg/enum_10.f90: Use -Wl,--no-enum-size-warning on
136 arm*-*-linux*eabi.
137
138 ChangeLog (line-endings)
139
140 gcc/testsuite/
141 * gfortran.dg/fmt_l.f90: Modify dg-output regexp to allow it to
142 match lines ending with CRLF.
143
144 ChangeLog (nested-function-alignment)
145
146 gcc/
147 * config/arm/arm.c: (arm_compute_static_chain_stack_bytes): New
148 function.
149 (arm_compute_initial_elimination_offset): Use it.
150 (arm_compute_save_reg_mask): Include static chain save slot when
151 calculating alignment.
152 (arm_get_frame_offsets): Ditto.
153
154 ChangeLog (r12)
155
156 gcc/
157 * config/arm/arm.c: (thumb1_compute_save_reg_mask): Ensure we
158 have a low register saved that we can use to decrement the stack
159 when the stack decrement could be too big for an immediate value
160 in a single insn.
161 (thumb1_expand_prologue): Avoid using r12 for stack decrement.
162
163 Index: gcc/testsuite/gfortran.dg/enum_10.f90
164 ===================================================================
165 *** gcc/testsuite/gfortran.dg/enum_10.f90 (revision 197947)
166 --- gcc/testsuite/gfortran.dg/enum_10.f90 (working copy)
167 ***************
168 *** 1,6 ****
169 --- 1,7 ----
170 ! { dg-do run }
171 ! { dg-additional-sources enum_10.c }
172 ! { dg-options "-fshort-enums -w" }
173 + ! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
174 ! Make sure short enums are indeed interoperable with the
175 ! corresponding C type.
176
177 Index: gcc/testsuite/gfortran.dg/fmt_l.f90
178 ===================================================================
179 --- gcc/testsuite/gfortran.dg/fmt_l.f90 (revision 197947)
180 +++ gcc/testsuite/gfortran.dg/fmt_l.f90 (working copy)
181 @@ -51,35 +51,35 @@
182 if (l8 .neqv. .false.) call abort
183
184 end program test_l
185 -! { dg-output "At line 14 of file.*" }
186 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
187 -! { dg-output "At line 15 of file.*" }
188 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
189 -! { dg-output "At line 19 of file.*" }
190 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
191 -! { dg-output "At line 20 of file.*" }
192 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
193 -! { dg-output "At line 24 of file.*" }
194 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
195 -! { dg-output "At line 25 of file.*" }
196 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
197 -! { dg-output "At line 29 of file.*" }
198 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
199 -! { dg-output "At line 30 of file.*" }
200 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
201 -! { dg-output "At line 34 of file.*" }
202 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
203 -! { dg-output "At line 35 of file.*" }
204 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
205 -! { dg-output "At line 39 of file.*" }
206 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
207 -! { dg-output "At line 40 of file.*" }
208 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
209 -! { dg-output "At line 44 of file.*" }
210 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
211 -! { dg-output "At line 45 of file.*" }
212 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
213 -! { dg-output "At line 49 of file.*" }
214 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
215 -! { dg-output "At line 50 of file.*" }
216 -! { dg-output "Fortran runtime warning: Positive width required in format\n" }
217 +! { dg-output "At line 14 of file.*\n" }
218 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
219 +! { dg-output "At line 15 of file.*\n" }
220 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
221 +! { dg-output "At line 19 of file.*\n" }
222 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
223 +! { dg-output "At line 20 of file.*\n" }
224 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
225 +! { dg-output "At line 24 of file.*\n" }
226 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
227 +! { dg-output "At line 25 of file.*\n" }
228 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
229 +! { dg-output "At line 29 of file.*\n" }
230 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
231 +! { dg-output "At line 30 of file.*\n" }
232 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
233 +! { dg-output "At line 34 of file.*\n" }
234 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
235 +! { dg-output "At line 35 of file.*\n" }
236 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
237 +! { dg-output "At line 39 of file.*\n" }
238 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
239 +! { dg-output "At line 40 of file.*\n" }
240 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
241 +! { dg-output "At line 44 of file.*\n" }
242 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
243 +! { dg-output "At line 45 of file.*\n" }
244 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
245 +! { dg-output "At line 49 of file.*\n" }
246 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
247 +! { dg-output "At line 50 of file.*\n" }
248 +! { dg-output "Fortran runtime warning: Positive width required in format.\r?\n" }
249 Index: gcc/config/arm/arm.c
250 ===================================================================
251 --- gcc/config/arm/arm.c (revision 206067)
252 +++ gcc/config/arm/arm.c (working copy)
253 @@ -62,6 +62,7 @@ const struct attribute_spec arm_attribut
254 void (*arm_lang_output_object_attributes_hook)(void);
255
256 /* Forward function declarations. */
257 +static int arm_compute_static_chain_stack_bytes (void);
258 static arm_stack_offsets *arm_get_frame_offsets (void);
259 static void arm_add_gc_roots (void);
260 static int arm_gen_constant (enum rtx_code, enum machine_mode, rtx,
261 @@ -10753,6 +10754,24 @@ arm_compute_save_reg0_reg12_mask (void)
262 }
263
264
265 +/* Compute the number of bytes used to store the static chain register on the
266 + stack, above the stack frame. We need to know this accurately to get the
267 + alignment of the rest of the stack frame correct. */
268 +
269 +static int arm_compute_static_chain_stack_bytes (void)
270 +{
271 + unsigned long func_type = arm_current_func_type ();
272 + int static_chain_stack_bytes = 0;
273 +
274 + if (frame_pointer_needed && TARGET_ARM &&
275 + IS_NESTED (func_type) &&
276 + df_regs_ever_live_p (3) && current_function_pretend_args_size == 0)
277 + static_chain_stack_bytes = 4;
278 +
279 + return static_chain_stack_bytes;
280 +}
281 +
282 +
283 /* Compute a bit mask of which registers need to be
284 saved on the stack for the current function. */
285
286 @@ -10804,7 +10823,9 @@ arm_compute_save_reg_mask (void)
287
288 if (TARGET_REALLY_IWMMXT
289 && ((bit_count (save_reg_mask)
290 - + ARM_NUM_INTS (current_function_pretend_args_size)) % 2) != 0)
291 + + ARM_NUM_INTS (current_function_pretend_args_size +
292 + arm_compute_static_chain_stack_bytes())
293 + ) % 2) != 0)
294 {
295 /* The total number of registers that are going to be pushed
296 onto the stack is odd. We need to ensure that the stack
297 @@ -11926,7 +11947,13 @@ thumb_force_lr_save (void)
298 from the soft frame pointer to the hard frame pointer.
299
300 SFP may point just inside the local variables block to ensure correct
301 - alignment. */
302 + alignment.
303 +
304 + FIXME: Under some circumstances arm_expand_prologue() may save the static
305 + chain register on the stack before the normal function prologue. For
306 + historical reasons all our offsets are wrong in this case, and
307 + arm_compute_static_chain_stack_bytes is used to compensate.
308 + arm_compute_initial_elimination_offset uses the same correction. */
309
310
311 /* Calculate stack offsets. These are used to calculate register elimination
312 @@ -12032,9 +12059,11 @@ arm_get_frame_offsets (void)
313 if (ARM_DOUBLEWORD_ALIGN)
314 {
315 /* Ensure SP remains doubleword aligned. */
316 - if (offsets->outgoing_args & 7)
317 + if ((offsets->outgoing_args +
318 + arm_compute_static_chain_stack_bytes()) & 7)
319 offsets->outgoing_args += 4;
320 - gcc_assert (!(offsets->outgoing_args & 7));
321 + gcc_assert (!((offsets->outgoing_args +
322 + arm_compute_static_chain_stack_bytes()) & 7));
323 }
324
325 return offsets;
326 @@ -12069,14 +12098,9 @@ arm_compute_initial_elimination_offset (
327 return offsets->soft_frame - offsets->saved_args;
328
329 case ARM_HARD_FRAME_POINTER_REGNUM:
330 - /* If there is no stack frame then the hard
331 - frame pointer and the arg pointer coincide. */
332 - if (offsets->frame == offsets->saved_regs)
333 - return 0;
334 - /* FIXME: Not sure about this. Maybe we should always return 0 ? */
335 - return (frame_pointer_needed
336 - && cfun->static_chain_decl != NULL
337 - && ! cfun->machine->uses_anonymous_args) ? 4 : 0;
338 + /* This is only non-zero in the case where the static chain register
339 + is stored above the frame. */
340 + return arm_compute_static_chain_stack_bytes();
341
342 case STACK_POINTER_REGNUM:
343 /* If nothing has been pushed on the stack at all
344 @@ -12347,6 +12371,8 @@ arm_expand_prologue (void)
345 insn = emit_set_insn (gen_rtx_REG (SImode, 3), ip_rtx);
346 else if (args_to_push == 0)
347 {
348 + gcc_assert(arm_compute_static_chain_stack_bytes() == 4);
349 +
350 rtx dwarf;
351
352 insn = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx);
353 Index: gcc/config/arm/arm.c
354 ===================================================================
355 --- gcc/config/arm/arm.c (revision 206069)
356 +++ gcc/config/arm/arm.c (working copy)
357 @@ -10910,6 +10910,26 @@ thumb1_compute_save_reg_mask (void)
358 mask |= 1 << reg;
359 }
360
361 + /* The 504 below is 8 bytes less than 512 because there are two possible
362 + alignment words. We can't tell here if they will be present or not so we
363 + have to play it safe and assume that they are. */
364 + if ((CALLER_INTERWORKING_SLOT_SIZE +
365 + ROUND_UP_WORD (get_frame_size ()) +
366 + current_function_outgoing_args_size) >= 504)
367 + {
368 + /* This is the same as the code in thumb1_expand_prologue() which
369 + determines which register to use for stack decrement. */
370 + for (reg = LAST_ARG_REGNUM + 1; reg <= LAST_LO_REGNUM; reg++)
371 + if (mask & (1 << reg))
372 + break;
373 +
374 + if (reg > LAST_LO_REGNUM)
375 + {
376 + /* Make sure we have a register available for stack decrement. */
377 + mask |= 1 << LAST_LO_REGNUM;
378 + }
379 + }
380 +
381 return mask;
382 }
383
384 @@ -16787,62 +16807,25 @@ thumb1_expand_prologue (void)
385 been pushed at the start of the prologue and so we can corrupt
386 it now. */
387 for (regno = LAST_ARG_REGNUM + 1; regno <= LAST_LO_REGNUM; regno++)
388 - if (live_regs_mask & (1 << regno)
389 - && !(frame_pointer_needed
390 - && (regno == THUMB_HARD_FRAME_POINTER_REGNUM)))
391 + if (live_regs_mask & (1 << regno))
392 break;
393
394 - if (regno > LAST_LO_REGNUM) /* Very unlikely. */
395 - {
396 - rtx spare = gen_rtx_REG (SImode, IP_REGNUM);
397 + gcc_assert(regno <= LAST_LO_REGNUM);
398
399 - /* Choose an arbitrary, non-argument low register. */
400 - reg = gen_rtx_REG (SImode, LAST_LO_REGNUM);
401 + reg = gen_rtx_REG (SImode, regno);
402
403 - /* Save it by copying it into a high, scratch register. */
404 - emit_insn (gen_movsi (spare, reg));
405 - /* Add a USE to stop propagate_one_insn() from barfing. */
406 - emit_insn (gen_prologue_use (spare));
407 + emit_insn (gen_movsi (reg, GEN_INT (- amount)));
408
409 - /* Decrement the stack. */
410 - emit_insn (gen_movsi (reg, GEN_INT (- amount)));
411 - insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
412 - stack_pointer_rtx, reg));
413 - RTX_FRAME_RELATED_P (insn) = 1;
414 - dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
415 - plus_constant (stack_pointer_rtx,
416 - -amount));
417 - RTX_FRAME_RELATED_P (dwarf) = 1;
418 - REG_NOTES (insn)
419 - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
420 - REG_NOTES (insn));
421 -
422 - /* Restore the low register's original value. */
423 - emit_insn (gen_movsi (reg, spare));
424 -
425 - /* Emit a USE of the restored scratch register, so that flow
426 - analysis will not consider the restore redundant. The
427 - register won't be used again in this function and isn't
428 - restored by the epilogue. */
429 - emit_insn (gen_prologue_use (reg));
430 - }
431 - else
432 - {
433 - reg = gen_rtx_REG (SImode, regno);
434 -
435 - emit_insn (gen_movsi (reg, GEN_INT (- amount)));
436 -
437 - insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
438 - stack_pointer_rtx, reg));
439 - RTX_FRAME_RELATED_P (insn) = 1;
440 - dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
441 - plus_constant (stack_pointer_rtx,
442 - -amount));
443 - RTX_FRAME_RELATED_P (dwarf) = 1;
444 - REG_NOTES (insn)
445 - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
446 - REG_NOTES (insn));
447 - }
448 + insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
449 + stack_pointer_rtx, reg));
450 + RTX_FRAME_RELATED_P (insn) = 1;
451 + dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
452 + plus_constant (stack_pointer_rtx,
453 + -amount));
454 + RTX_FRAME_RELATED_P (dwarf) = 1;
455 + REG_NOTES (insn)
456 + = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
457 + REG_NOTES (insn));
458 }
459 }