egcs 980315 bug on powerpc-unknown-linux-gnulibc1

David Edelsohn dje@watson.ibm.com
Tue May 19 15:14:00 GMT 1998


>>>>> Franz Sirl writes:

Franz> @@ -4523,7 +4542,7 @@
Franz> #endif
Franz> else if (TARGET_NEW_MNEMONICS)
Franz> {
Franz> -  fprintf (file, "\taddis %s,%s,", reg_names[11], reg_names[11]);
Franz> +  fprintf (file, "\tlis %s,", reg_names[11]);
Franz> assemble_name (file, buf);
Franz> fprintf (file, "@ha\n");
Franz> fprintf (file, "\tstw %s,4(%s)\n", reg_names[0], reg_names[1]);

>>>>> Jeffrey A Law writes:

Jeff> This isn't just a change in mnemonic, it's a change in operation.

Jeff> The old code does

Jeff> addis 11,11,<label>

Jeff> Which I would guess adds the value in r11 to the label's address
Jeff> and stores the value in r11.

Jeff> The new code does

Jeff> lis 11,<label>

Jeff> Which would just load the address of the label into r11.

Jeff> r11 is a call clobbered register which has no known value at the
Jeff> start of most functions (the exception would be a function called
Jeff> with a static chain pointer since r11 is the static chain register).

	rs6000.c:rs6000_output_load_toc_table() -- non-TARGET_RELOCATABLE
branch -- does something similar and there it is:

      asm_fprintf (file, "\t{cau|addis} %s,%s,", reg_names[reg], reg_names[0]);
      assemble_name (file, buf);
      asm_fprintf (file, "@ha\n");

which really is "lis".  It looks like someone was trying to avoid two
different syntax formats, but that was a waste of time because two lines
later it needs to support both anyway.  The new mnemonic form should just
duplicate the code and use "lis" there as well for consitency instead of
trying to use {cau|addis} choice.

	My only concern about rs6000.c:output_function_profiler() is that
it explicitly uses r11 earlier (to gain GOT addressibility?)  I guess it is
using r11 as a scratch.  From my understanding of GOT, it definitely does
not make sense to *add* the GOT relocation high address to a value in a
register.

David




More information about the Gcc-bugs mailing list