This is the mail archive of the
mailing list for the GCC project.
Re: question regarding regrename and failure of 950704-1.c on main
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: law at redhat dot com
- Cc: rth at redhat dot com, gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 11 May 2002 20:38:37 -0400 (EDT)
- Subject: Re: question regarding regrename and failure of 950704-1.c on main
> I really think we're better off fixing regrename to be a little more careful
> about it's actions in respect to HARD_REGNO_MODE_OK.
I have tested <http://gcc.gnu.org/ml/gcc/2002-05/msg00787.html> under
hppa2.0-hp-hpux11.11. It resolves the failure of 950704-1.c. It
successfully preserves the initial argument copies and prevents overlap
of source and destination registers in DImode operations. The only
drawback is the resulting code is slightly less efficient than the
patch below because of these initial copies being preserved.
As far as I can tell, the branch has the same problem as the main. The
reason the failure hasn't been observed on the branch appears to be
because the initial copy for (%r23,%r24) goes to (%r22,%23) and there
is a check in copy_value to see if the source and destination overlap.
This preserves the copy in this particular case. However, if the
order of register allocation changes, then the failure will occur.
Thus, I think either my patch or Richard's should be applied to the
branch at an appropriate time. I think this can wait for 3.1.1.
I have no objection to Richard's patch going into the main as well.
It looks as if there may be a similar issue for the 64-bit ports.
> Twiddling HARD_REGNO_MODE_OK to switch from even regs to odd regs probably
> does make sense for the mainline, but not for the branch. We'll still
> need some register shuffling for the return value, but it should be less
> than the amount we're currently doing for input arguments.
I have installed the enclosed patch on the mainline. It results in better
code than with Richard's patch to regrename.c. Bootstrapped and regression
tested under hppa-linux (mainline) and hppa2.0-hp-hpux11.00 (3.1 branch).
J. David Anglin email@example.com
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2002-05-11 John David Anglin <firstname.lastname@example.org>
* pa/pa32-regs.h (HARD_REGNO_MODE_OK): Revise sets of general registers
used for DImode and TImode.
RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa32-regs.h,v
retrieving revision 1.9
diff -u -3 -p -r1.9 pa32-regs.h
--- config/pa/pa32-regs.h 11 Nov 2001 17:45:02 -0000 1.9
+++ config/pa/pa32-regs.h 11 May 2002 23:33:12 -0000
@@ -164,8 +164,11 @@
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the HP-PA, the cpu registers can hold any mode. We
- force this to be an even register is it cannot hold the full mode. */
+ On the HP-PA, the cpu registers can hold any mode. For DImode, we
+ choose a set of general register that includes the incoming arguments
+ and the return value. We specify a set with no overlaps so that we don't
+ have to specify that the destination register in patterns using this mode
+ is an early clobber. */
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
((REGNO) == 0 ? (MODE) == CCmode || (MODE) == CCFPmode \
/* On 1.0 machines, don't allow wide non-fp modes in fp regs. */ \
@@ -173,9 +176,11 @@
? GET_MODE_SIZE (MODE) <= 4 || GET_MODE_CLASS (MODE) == MODE_FLOAT \
: FP_REGNO_P (REGNO) \
? GET_MODE_SIZE (MODE) <= 4 || ((REGNO) & 1) == 0 \
- /* Make wide modes be in aligned registers. */ \
: (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD \
- || (GET_MODE_SIZE (MODE) <= 4 * UNITS_PER_WORD && ((REGNO) & 1) == 0)))
+ || (GET_MODE_SIZE (MODE) == 2 * UNITS_PER_WORD \
+ && ((((REGNO) & 1) == 1 && (REGNO) <= 25) || (REGNO) == 28)) \
+ || (GET_MODE_SIZE (MODE) == 4 * UNITS_PER_WORD \
+ && (((REGNO) & 3) == 3 && (REGNO) <= 23))))
/* How to renumber registers for dbx and gdb.