This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: stormy16: limit SI reload regs
- From: Geoff Keating <geoffk at geoffk dot org>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 29 Apr 2003 15:00:20 -0700
- Subject: Re: stormy16: limit SI reload regs
- References: <200304292136.h3TLa8809569@greed.delorie.com>
DJ Delorie <dj@redhat.com> writes:
> One of our internal branches uncovered a failure (not reproducible in
> fsf by coincidence) in divconst-2, whereby $r7 is used as the target
> of an SI move, but that can't be split into two HI moves because $r8
> can't be used that way after the split. Reload chose $r7 because it's
> in EIGHT_REGS but neglected to see if the mode required registers
> outside that class. I'm not sure if that's reload's fault or not, but
> I did have success with the attached patch, which creates a sub-class
> just for pre-split SI moves. Comments?
Yes, this is what you're supposed to do in cases like this.
This patch would be OK if it had a ChangeLog and had been tested (hint
hint :-) ).
> Index: stormy16.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.c,v
> retrieving revision 1.38
> diff -p -2 -r1.38 stormy16.c
> *** stormy16.c 17 Apr 2003 10:35:08 -0000 1.38
> --- stormy16.c 29 Apr 2003 21:23:17 -0000
> *************** xstormy16_secondary_reload_class (class,
> *** 524,528 ****
> || true_regnum (x) >= FIRST_PSEUDO_REGISTER)))
> && ! reg_class_subset_p (class, EIGHT_REGS))
> ! return EIGHT_REGS;
>
> /* When reloading a PLUS, the carry register will be required
> --- 524,528 ----
> || true_regnum (x) >= FIRST_PSEUDO_REGISTER)))
> && ! reg_class_subset_p (class, EIGHT_REGS))
> ! return GET_MODE (x) == SImode ? SEVEN_REGS : EIGHT_REGS;
>
> /* When reloading a PLUS, the carry register will be required
> *************** xstormy16_preferred_reload_class (x, cla
> *** 576,580 ****
> if (class == GENERAL_REGS
> && GET_CODE (x) == MEM)
> ! return EIGHT_REGS;
>
> return class;
> --- 576,580 ----
> if (class == GENERAL_REGS
> && GET_CODE (x) == MEM)
> ! return GET_MODE (x) == SImode ? SEVEN_REGS : EIGHT_REGS;
>
> return class;
> Index: stormy16.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.h,v
> retrieving revision 1.73
> diff -p -2 -r1.73 stormy16.h
> *** stormy16.h 17 Apr 2003 10:35:08 -0000 1.73
> --- stormy16.h 29 Apr 2003 21:23:17 -0000
> *************** enum reg_class
> *** 405,408 ****
> --- 405,409 ----
> TWO_REGS,
> R2_REGS,
> + SEVEN_REGS,
> EIGHT_REGS,
> R8_REGS,
> *************** enum reg_class
> *** 428,431 ****
> --- 429,433 ----
> "TWO_REGS", \
> "R2_REGS", \
> + "SEVEN_REGS", \
> "EIGHT_REGS", \
> "R8_REGS", \
> *************** enum reg_class
> *** 453,456 ****
> --- 455,459 ----
> { 0x00003 }, \
> { 0x00004 }, \
> + { 0x0007F }, \
> { 0x000FF }, \
> { 0x00100 }, \
> *************** enum reg_class
> *** 468,471 ****
> --- 471,475 ----
> : (REGNO) == 1 ? R1_REGS \
> : (REGNO) == 2 ? R2_REGS \
> + : (REGNO) < 7 ? SEVEN_REGS \
> : (REGNO) < 8 ? EIGHT_REGS \
> : (REGNO) == 8 ? R8_REGS \
> *************** enum reg_class
> *** 506,509 ****
> --- 510,514 ----
> : (CHAR) == 'c' ? R2_REGS \
> : (CHAR) == 'd' ? R8_REGS \
> + : (CHAR) == 'f' ? SEVEN_REGS \
> : (CHAR) == 'e' ? EIGHT_REGS \
> : (CHAR) == 't' ? TWO_REGS \
> Index: stormy16.md
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.md,v
> retrieving revision 1.11
> diff -p -2 -r1.11 stormy16.md
> *** stormy16.md 6 Mar 2003 20:03:49 -0000 1.11
> --- stormy16.md 29 Apr 2003 21:23:17 -0000
> ***************
> *** 1,4 ****
> ;; XSTORMY16 Machine description template
> ! ;; Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
> ;; Contributed by Red Hat, Inc.
>
> --- 1,4 ----
> ;; XSTORMY16 Machine description template
> ! ;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
> ;; Contributed by Red Hat, Inc.
>
> ***************
> *** 188,193 ****
>
> (define_insn_and_split "*movsi_internal"
> ! [(set (match_operand:SI 0 "nonimmediate_operand" "=r,Q,r,m,e,&e,e,r,S")
> ! (match_operand:SI 1 "general_operand" "r,r,R,e,o, V,L,i,i"))]
> ""
> "#"
> --- 188,193 ----
>
> (define_insn_and_split "*movsi_internal"
> ! [(set (match_operand:SI 0 "nonimmediate_operand" "=r,Q,r,m,f,&f,f,r,S")
> ! (match_operand:SI 1 "general_operand" "r,r,R,f,o, V,L,i,i"))]
> ""
> "#"
>
--
- Geoffrey Keating <geoffk@geoffk.org>