Thread (66 messages) 66 messages, 6 authors, 2020-04-15

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

From: Christophe Leroy <hidden>
Date: 2020-04-08 18:46:01


Le 08/04/2020 à 20:11, Segher Boessenkool a écrit :
On Mon, Apr 06, 2020 at 12:25:27PM +0200, Christophe Leroy wrote:
quoted
quoted
	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help