From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28418 invoked by alias); 15 May 2003 10:56:01 -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 28346 invoked by uid 71); 15 May 2003 10:56:01 -0000 Date: Thu, 15 May 2003 10:56:00 -0000 Message-ID: <20030515105601.28322.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Kazuhiro Inaoka Subject: Re: target/10775: m32r-elf-gcc -O3 (regrename) used lr in leaf-functions without saving Reply-To: Kazuhiro Inaoka X-SW-Source: 2003-05/txt/msg01782.txt.bz2 List-Id: The following reply was made to PR target/10775; it has been noted by GNATS. From: Kazuhiro Inaoka To: Dara Hazeghi , gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: target/10775: m32r-elf-gcc -O3 (regrename) used lr in leaf-functions without saving Date: Thu, 15 May 2003 19:49:39 +0900 Hello, > gcc 3.3 is in the process of being released. Would it be possible for > you to check whether the error still occurs with that version? Thanks, It still occurs on gcc 3.3. .section .data .balign 2 .type adjust, @object .size adjust, 8 adjust: .hword 0 .hword 0 .hword 1 .hword 1 .section .text .balign 4 .global main .type main, @function main: ; PROLOGUE, vars= 4, regs= 1, args= 0, extra= 0 push lr ldi r0,#1 addi sp,#-4 sth r0,@(2,sp) add3 r1,sp,#2 sth r0,@(sp) mv r0,sp bl adjust_xy ldh r0,@(sp) addi r0,#-1 beqz r0,.L2 bl abort .L2: ldi r0,#0 ; 0x0 bl exit ; EPILOGUE addi sp,#4 pop lr jmp lr .size main, .-main .balign 4 .global adjust_xy .type adjust_xy, @function adjust_xy: ; PROLOGUE, vars= 0, regs= 0, args= 0, extra= 0 ld24 r2,#adjust lduh r6,@(2,r2) lduh lr,@(4,r2) <---- use lr lduh r7,@(r1) lduh r4,@(r2) lduh r5,@(r0) mullo r6,r7 mvfacmi r3 mullo r4,r5 mvfacmi r1 add r1,r3 add r1,lr sth r1,@(r0) ; EPILOGUE jmp lr <---- broken lr .size adjust_xy, .-adjust_xy .ident "GCC: (GNU) 3.3" I sent following patch. to gcc-patches@gcc.gnu.org. But I can't find it in gcc-patches ML. ? Subject is [PATCH] PR target/10775 Hi, This patch is a proposed fix to the gcc-3.2.3 testsuite failure of gcc.c-torture/execute/20000726-1.c (PR .10775) Kazuhiro Inaoka gcc/ChangeLog PR 10775 * config/m32r/m32r.h (HARD_REGNO_RENAME_OK): New macro. config/m32r.c: New m32r_hard_regno_rename_ok config/m32r-protos.h : Add the prototype for m32r_hard_regno_rename_ok diff -u org_src/gcc-3.2.3/gcc/config/m32r/m32r-protos.h gcc-3.2.3/gcc/config/m32r/m32r-protos.h --- org_src/gcc-3.2.3/gcc/config/m32r/m32r-protos.h Mon Dec 10 05:13:14 2001 +++ gcc-3.2.3/gcc/config/m32r/m32r-protos.h Wed May 14 14:07:35 2003 @@ -60,6 +60,7 @@ extern void m32r_print_operand_address PARAMS ((FILE *, rtx)); extern int m32r_address_cost PARAMS ((rtx)); extern int m32r_not_same_reg PARAMS ((rtx, rtx)); +extern int m32r_hard_regno_rename_ok PARAMS ((unsigned int, unsigned int)); #ifdef HAVE_MACHINE_MODES extern int call_address_operand PARAMS ((rtx, Mmode)); diff -u org_src/gcc-3.2.3/gcc/config/m32r/m32r.c gcc-3.2.3/gcc/config/m32r/m32r.c --- org_src/gcc-3.2.3/gcc/config/m32r/m32r.c Sat Mar 23 04:25:51 2002 +++ gcc-3.2.3/gcc/config/m32r/m32r.c Wed May 14 14:26:57 2003 @@ -2968,3 +2968,20 @@ return 1; } + +int m32r_hard_regno_rename_ok(old_reg, new_reg) + unsigned int old_reg ATTRIBUTE_UNUSED; + unsigned int new_reg; +{ + if ((lookup_attribute ("interrupt", + DECL_ATTRIBUTES (current_function_decl)) + != NULL_TREE) + && !regs_ever_live[new_reg]) + return 0; + + if (current_function_is_leaf && (new_reg == RETURN_ADDR_REGNUM)) + return 0; + + return 1; +} + diff -u org_src/gcc-3.2.3/gcc/config/m32r/m32r.h gcc-3.2.3/gcc/config/m32r/m32r.h --- org_src/gcc-3.2.3/gcc/config/m32r/m32r.h Wed Jan 9 07:51:33 2002 +++ gcc-3.2.3/gcc/config/m32r/m32r.h Wed May 14 14:06:15 2003 @@ -670,6 +670,9 @@ && GET_MODE_CLASS (MODE2) == MODE_INT \ && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \ && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD) + +#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \ + m32r_hard_regno_rename_ok(OLD_REG, NEW_REG) /* Register classes and constants. */ Kazuhiro Inaoka