Le 08/04/2020 à 20:11, Segher Boessenkool a écrit :
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.

Ah, yes, I read too fast https://patchwork.ozlabs.org/patch/1266721/

It's not 64 bits, it is 64 bytes.


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


Christophe

Reply via email to