From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6905 invoked by alias); 14 Mar 2002 15:16:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 6868 invoked by uid 71); 14 Mar 2002 15:16:04 -0000 Date: Thu, 14 Mar 2002 07:16:00 -0000 Message-ID: <20020314151604.6865.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Richard Earnshaw Subject: Re: target/5828: gcc-3.0.4 on arm : floating point registers incorrectly reloaded Reply-To: Richard Earnshaw X-SW-Source: 2002-03/txt/msg00475.txt.bz2 List-Id: The following reply was made to PR target/5828; it has been noted by GNATS. From: Richard Earnshaw To: jeroen dobbelaere Cc: gcc-patches@gcc.gnu.org, gcc-gnats@gcc.gnu.org, Richard.Earnshaw@arm.com Subject: Re: target/5828: gcc-3.0.4 on arm : floating point registers incorrectly reloaded Date: Thu, 14 Mar 2002 15:13:28 +0000 This is a multipart MIME message. --==_Exmh_-16759862300 Content-Type: text/plain; charset=us-ascii Richard Earnshaw wrote: > + 2002-03-04 Jeroen Dobbelaere > + > + * config/arm/arm.c (arm_output_epilogue): bug 5828 : offset > + must start at 0 in stead of 12. > + > > This patch is incorrect. [...] > 2) It is cludge to work around another bug further down the function. Having thought about this some more, I've revised my opinion. This a slightly different, but equally valid, way of looking at the problem. However, it slightly confuses the way the offsets are being calculated. I've committed the following patch to correct the problem: 2002-03-14 Richard Earnshaw Jeroen Dobbelaere PR target/5828 * arm.c (arm_output_epilogue): Fix floating-point register save adjustment when using a frame pointer. --==_Exmh_-16759862300 Content-Type: text/x-patch ; name="gcc-armfpsave.patch"; charset=us-ascii Content-Description: gcc-armfpsave.patch Content-Disposition: attachment; filename="gcc-armfpsave.patch" Index: arm.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v retrieving revision 1.197 diff -p -r1.197 arm.c *** arm.c 2002/03/13 05:42:33 1.197 --- arm.c 2002/03/14 15:03:26 *************** arm_output_epilogue (really_return) *** 7467,7474 **** int reg; unsigned long saved_regs_mask; unsigned long func_type; ! /* If we need this, then it will always be at least this much. */ ! int floats_offset = 12; rtx operands[3]; int frame_size = get_frame_size (); FILE * f = asm_out_file; --- 7467,7475 ---- int reg; unsigned long saved_regs_mask; unsigned long func_type; ! /* Floats_offset is the offset from the "virtual" frame. In an APCS ! frame that is $fp + 4 for a non-variadic function. */ ! int floats_offset = 0; rtx operands[3]; int frame_size = get_frame_size (); FILE * f = asm_out_file; *************** arm_output_epilogue (really_return) *** 7505,7510 **** --- 7506,7514 ---- saved_regs_mask = arm_compute_save_reg_mask (); + /* XXX We should adjust floats_offset for any anonymous args, and then + re-adjust vfp_offset below to compensate. */ + /* Compute how far away the floats will be. */ for (reg = 0; reg <= LAST_ARM_REGNUM; reg ++) if (saved_regs_mask & (1 << reg)) *************** arm_output_epilogue (really_return) *** 7512,7517 **** --- 7516,7523 ---- if (frame_pointer_needed) { + int vfp_offset = 4; + if (arm_fpu_arch == FP_SOFT2) { for (reg = LAST_ARM_FP_REGNUM; reg >= FIRST_ARM_FP_REGNUM; reg--) *************** arm_output_epilogue (really_return) *** 7519,7525 **** { floats_offset += 12; asm_fprintf (f, "\tldfe\t%r, [%r, #-%d]\n", ! reg, FP_REGNUM, floats_offset); } } else --- 7525,7531 ---- { floats_offset += 12; asm_fprintf (f, "\tldfe\t%r, [%r, #-%d]\n", ! reg, FP_REGNUM, floats_offset - vfp_offset); } } else *************** arm_output_epilogue (really_return) *** 7536,7542 **** if (start_reg - reg == 3) { asm_fprintf (f, "\tlfm\t%r, 4, [%r, #-%d]\n", ! reg, FP_REGNUM, floats_offset); start_reg = reg - 1; } } --- 7542,7548 ---- if (start_reg - reg == 3) { asm_fprintf (f, "\tlfm\t%r, 4, [%r, #-%d]\n", ! reg, FP_REGNUM, floats_offset - vfp_offset); start_reg = reg - 1; } } *************** arm_output_epilogue (really_return) *** 7545,7551 **** if (reg != start_reg) asm_fprintf (f, "\tlfm\t%r, %d, [%r, #-%d]\n", reg + 1, start_reg - reg, ! FP_REGNUM, floats_offset); start_reg = reg - 1; } } --- 7551,7557 ---- if (reg != start_reg) asm_fprintf (f, "\tlfm\t%r, %d, [%r, #-%d]\n", reg + 1, start_reg - reg, ! FP_REGNUM, floats_offset - vfp_offset); start_reg = reg - 1; } } *************** arm_output_epilogue (really_return) *** 7554,7560 **** if (reg != start_reg) asm_fprintf (f, "\tlfm\t%r, %d, [%r, #-%d]\n", reg + 1, start_reg - reg, ! FP_REGNUM, floats_offset); } /* saved_regs_mask should contain the IP, which at the time of stack --- 7560,7566 ---- if (reg != start_reg) asm_fprintf (f, "\tlfm\t%r, %d, [%r, #-%d]\n", reg + 1, start_reg - reg, ! FP_REGNUM, floats_offset - vfp_offset); } /* saved_regs_mask should contain the IP, which at the time of stack --==_Exmh_-16759862300--