[PATCH 1/2] MIPS/GAS: Fix o32 LD to the base register
Richard Sandiford
rdsandiford@googlemail.com
Mon Oct 18 07:48:00 GMT 2010
"Maciej W. Rozycki" <macro@linux-mips.org> writes:
> Here's another one:
>
> $ cat ld-base.s
> ld $4, ($4)
> $ mips-linux-as -o ld-base.o ld-base.s
> $ mips-linux-objdump -d ld-base.o
>
> ld-base.o: file format elf32-tradbigmips
>
>
> Disassembly of section .text:
>
> 00000000 <.text>:
> 0: 8c840000 lw a0,0(a0)
> 4: 00000000 nop
> 8: 8c850004 lw a1,4(a0)
>
> Ouch!
>
> Fixed thus and regression tested for mips-linux, mips64-linux,
> mipstx39-elf, mipsisa64-elf and mips-ecoff targets and their little-endian
> counterparts. The new code produced looks like this:
>
> $ mips-linux-objdump -d ld-base.o
>
> ld-base.o: file format elf32-tradbigmips
>
>
> Disassembly of section .text:
>
> 00000000 <.text>:
> 0: 00800821 move at,a0
> 4: 8c240000 lw a0,0(at)
> 8: 8c250004 lw a1,4(at)
Why are you doing it this way, rather than reversing the loads?
Seems a shame to use $at when we don't need to.
Richard
More information about the Binutils
mailing list