gcc for ppc, regnames bug
Jonathan Walton
jonboy@gordian.com
Tue Apr 4 17:39:00 GMT 2000
There is a MASK_REGNAMES define in the ppc code, but it doesn't properly
affect the output of pre increment/decrement load references, as it should
do.
Below is an example which makes it show up when using -O2. I've included a
patch below, but this is only verifying one of the two mods I made, i guess.
This is version 2.95.2, configured as follows:
../src/configure --with-gcc-version-trigger=/mnt/gordian/src/ppc-tools/src/gcc/version.c --host=i686-pc-linux-gnu --target=powerpc-eabi --prefix=/usr/local/ppc-tools-000321 -v --nfp --norecursion
Jonathan
> /usr/local/ppc-tools-000321/bin/powerpc-eabi-gcc -v
Reading specs from /usr/local/ppc-tools-000321/lib/gcc-lib/powerpc-eabi/2.95.2/specs
gcc version 2.95.2 19991024 (release)
> cat foo.c
extern char ary[];
void foo(const char *str)
{
while ((ary[(int)( *str )] & 0x08 ) )
str++;
}
> /usr/local/ppc-tools-000321/bin/powerpc-eabi-gcc -mregnames foo.c -S -O2 -o foo.ss
> /usr/local/ppc-tools-000331/bin/powerpc-eabi-gcc -mregnames foo.c -S -O2 -o foo.sspatch
> diff foo.ss foo.sspatch
15c15
< lbzu %r0,1(3)
---
> lbzu %r0,1(%r3)
> cat gcc_regnames_bug.patch
*** config/rs6000/rs6000.c Tue Apr 4 15:03:37 2000
--- pregordian/config/rs6000/rs6000.c Fri Mar 31 17:31:36 2000
*************** print_operand (file, x, code)
*** 3241,3251 ****
/* We need to handle PRE_INC and PRE_DEC here, since we need to
know the width from the mode. */
if (GET_CODE (XEXP (x, 0)) == PRE_INC)
! fprintf (file, "%d(%s)", GET_MODE_SIZE (GET_MODE (x)),
! reg_names[REGNO (XEXP (XEXP (x, 0), 0))]);
else if (GET_CODE (XEXP (x, 0)) == PRE_DEC)
! fprintf (file, "%d(%s)", - GET_MODE_SIZE (GET_MODE (x)),
! reg_names[REGNO (XEXP (XEXP (x, 0), 0))]);
else
output_address (XEXP (x, 0));
}
--- 3241,3251 ----
/* We need to handle PRE_INC and PRE_DEC here, since we need to
know the width from the mode. */
if (GET_CODE (XEXP (x, 0)) == PRE_INC)
! fprintf (file, "%d(%d)", GET_MODE_SIZE (GET_MODE (x)),
! REGNO (XEXP (XEXP (x, 0), 0)));
else if (GET_CODE (XEXP (x, 0)) == PRE_DEC)
! fprintf (file, "%d(%d)", - GET_MODE_SIZE (GET_MODE (x)),
! REGNO (XEXP (XEXP (x, 0), 0)));
else
output_address (XEXP (x, 0));
}
More information about the Gcc-bugs
mailing list