[PATCH v5 18/21] powerpc64: Add prefixed instructions to instruction data type

Segher Boessenkool segher at kernel.crashing.org
Thu Apr 9 04:11:01 AEST 2020


On Mon, Apr 06, 2020 at 12:25:27PM +0200, Christophe Leroy wrote:
> >	if (ppc_inst_prefixed(x) != ppc_inst_prefixed(y))
> >		return false;
> >	else if (ppc_inst_prefixed(x))
> >		return !memcmp(&x, &y, sizeof(struct ppc_inst));
> 
> Are we sure memcmp() is a good candidate for the comparison ? Can we do 
> simpler ? Especially, I understood a prefixed instruction is a 64 bits 
> properly aligned instruction, can we do a simple u64 compare ? Or is GCC 
> intelligent enough to do that without calling memcmp() function which is 
> heavy ?

A prefixed insn is *not* 8-byte aligned, it is 4-byte aligned, fwiw.

memcmp() isn't as heavy as you fear, not with a non-ancient GCC at least.
But this could be written in a nicer way, sure :-)


Segher


More information about the Linuxppc-dev mailing list