From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28677 invoked by alias); 8 Jul 2004 08:42:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28667 invoked from network); 8 Jul 2004 08:42:45 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 8 Jul 2004 08:42:45 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i688gie1023784; Thu, 8 Jul 2004 04:42:44 -0400 Received: from localhost (mail@vpn50-37.rdu.redhat.com [172.16.50.37]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i688gh012425; Thu, 8 Jul 2004 04:42:43 -0400 Received: from rsandifo by localhost with local (Exim 3.35 #1) id 1BiUUL-0008EZ-00; Thu, 08 Jul 2004 09:42:41 +0100 To: Alexandre Oliva Cc: Kazu Hirata , gcc-patches@gcc.gnu.org Subject: Re: add h8sx support to h8300 References: <20040621.102356.74724063.kazu@cs.umass.edu> <87fz83f456.fsf@redhat.com> From: Richard Sandiford Date: Thu, 08 Jul 2004 09:39:00 -0000 In-Reply-To: (Alexandre Oliva's message of "08 Jul 2004 04:06:03 -0300") Message-ID: <87zn6aevpa.fsf@redhat.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-07/txt/msg00757.txt.bz2 Alexandre Oliva writes: > gcc.c-torture/execute/builtin-setjmp.c. It *still* fails at -O3 > -fomit-frame-pointer, but not at lower optimization levels, which it > did before. Are you sure it's still needed? Is it possible that whatever was causing the failure was fixed by another patch? I tried the attached, both with and without the h8300.md bit, and it didn't make any difference to the results for this testcase. Like you say, -O3 -fomit-frame-pointer fails either way. FWIW, the test pattern was h8300-sim{-msx}{,-mn}. I just remember this making quite a big difference to quality of the output, but it was over a year ago, so perhaps I'm misremembering, or perhaps it doesn't make as much difference now. Richard Index: config/h8300/h8300.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v retrieving revision 1.290 diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.290 h8300.c --- config/h8300/h8300.c 8 Jul 2004 03:40:31 -0000 1.290 +++ config/h8300/h8300.c 8 Jul 2004 08:37:36 -0000 @@ -454,16 +454,12 @@ h8300_init_once (void) before reload so that register allocator will pick the second alternative. - - we would like 'D' to be be NO_REGS when the frame pointer isn't - live, but we the frame pointer may turn out to be needed after - we start reload, and then we may have already decided we don't - have a choice, so we can't do that. Forcing the register - allocator to use er6 if possible might produce better code for - small functions: it's more efficient to save and restore er6 in - the prologue & epilogue than to do it in a define_split. - Hopefully disparaging 'D' will have a similar effect, without - forcing a reload failure if the frame pointer is found to be - needed too late. */ + - 'D' should be NO_REGS when the frame pointer isn't live. + The idea is to *make* it live by restricting the register allocator + to the first alternative. This isn't needed for correctness + but it produces better code for small functions: it's more + efficient to save and restore er6 in the prologue & epilogue + than to do it in a define_split. */ enum reg_class h8300_reg_class_from_letter (int c) @@ -484,8 +480,8 @@ h8300_reg_class_from_letter (int c) return DESTINATION_REGS; case 'D': - /* The meaning of a constraint shouldn't change dynamically, so - we can't make this NO_REGS. */ + if (!regs_ever_live[FP_REG]) + return NO_REGS; return GENERAL_REGS; case 'f': @@ -3051,10 +3047,6 @@ h8300_swap_into_er6 (rtx addr) { push (HARD_FRAME_POINTER_REGNUM); emit_move_insn (hard_frame_pointer_rtx, addr); - if (REGNO (addr) == SP_REG) - emit_move_insn (hard_frame_pointer_rtx, - plus_constant (hard_frame_pointer_rtx, - GET_MODE_SIZE (word_mode))); } /* Move the current value of er6 into ADDR and pop its old value @@ -3063,8 +3055,7 @@ h8300_swap_into_er6 (rtx addr) void h8300_swap_out_of_er6 (rtx addr) { - if (REGNO (addr) != SP_REG) - emit_move_insn (addr, hard_frame_pointer_rtx); + emit_move_insn (addr, hard_frame_pointer_rtx); pop (HARD_FRAME_POINTER_REGNUM); } Index: config/h8300/h8300.md =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v retrieving revision 1.286 diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.286 h8300.md --- config/h8300/h8300.md 8 Jul 2004 03:40:33 -0000 1.286 +++ config/h8300/h8300.md 8 Jul 2004 08:37:37 -0000 @@ -574,7 +574,7 @@ (define_insn "movmd_internal_normal" (mem:BLK (match_operand:HI 4 "register_operand" "1,1"))) (unspec [(match_operand:HI 5 "register_operand" "2,2") (match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD) - (clobber (match_operand:HI 0 "register_operand" "=d,??D")) + (clobber (match_operand:HI 0 "register_operand" "=d,!D")) (clobber (match_operand:HI 1 "register_operand" "=f,f")) (set (match_operand:HI 2 "register_operand" "=c,c") (const_int 0))] @@ -591,7 +591,7 @@ (define_insn "movmd_internal" (mem:BLK (match_operand:SI 4 "register_operand" "1,1"))) (unspec [(match_operand:HI 5 "register_operand" "2,2") (match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD) - (clobber (match_operand:SI 0 "register_operand" "=d,??D")) + (clobber (match_operand:SI 0 "register_operand" "=d,!D")) (clobber (match_operand:SI 1 "register_operand" "=f,f")) (set (match_operand:HI 2 "register_operand" "=c,c") (const_int 0))] @@ -702,7 +702,7 @@ (define_insn "stpcpy_internal_normal" [(set (mem:BLK (match_operand:HI 3 "register_operand" "0,r")) (unspec:BLK [(mem:BLK (match_operand:HI 4 "register_operand" "1,1"))] UNSPEC_STPCPY)) - (clobber (match_operand:HI 0 "register_operand" "=d,??D")) + (clobber (match_operand:HI 0 "register_operand" "=d,!D")) (clobber (match_operand:HI 1 "register_operand" "=f,f")) (clobber (match_operand:HI 2 "register_operand" "=c,c"))] "TARGET_H8300SX && TARGET_NORMAL_MODE" @@ -716,7 +716,7 @@ (define_insn "stpcpy_internal" [(set (mem:BLK (match_operand:SI 3 "register_operand" "0,r")) (unspec:BLK [(mem:BLK (match_operand:SI 4 "register_operand" "1,1"))] UNSPEC_STPCPY)) - (clobber (match_operand:SI 0 "register_operand" "=d,??D")) + (clobber (match_operand:SI 0 "register_operand" "=d,!D")) (clobber (match_operand:SI 1 "register_operand" "=f,f")) (clobber (match_operand:SI 2 "register_operand" "=c,c"))] "TARGET_H8300SX && !TARGET_NORMAL_MODE"