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

From: Segher Boessenkool <[email-masked]>
Date: Wed, 8 Apr 2020 13:11:01 -0500

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