This is the mail archive of the
mailing list for the binutils project.
Re: [GOLD] PowerPC64 toc code optimization
On Thu, Dec 06, 2012 at 10:35:15AM -0800, Doug Kwan (éæå) wrote:
> The pattern "(insn & (0x3f << 26)) == XXX << 26" repeats so many
> times. Why not define a predicate? It would be difficult to spot a
> typo if there was one.
Mostly because this is known good working code copied from
elf64-ppc.c. Changing it runs the risk of the typo you're concerned
Also, I prefer this style in this particular case. Someone can read
the powerpc architecture manual and be assured that the correct bits
are being compared with the correct values. In particular, lines like
the following have all this information in one place:
|| ((insn & (0x3f << 26)) == 58u << 26 /* lwa,ld,lmd */
&& (insn & 3) != 1)
The alternative you propose would be something like
|| (is_opcode(insn, 58) && (insn & 3) != 1) /* lwa,ld,lmd */
and now you need to look in two places.
Australia Development Lab, IBM