On 14/07/17 09:56, Jakub Jelinek wrote:
On Fri, Jul 14, 2017 at 09:45:39AM +0100, Thomas Preudhomme wrote:
+ else if (!bswap)
+ {
Would it make sense to add an assert right here checking that this is a
cmpnop operation?
The earlier bswap_replace code to handle n->base_addr && !bswap doesn't
have anything like that either.
And the assert would be certainly non-trivial, like:
#if ENABLE_ASSERT_CHECKING
uint64_t cmpnop = CMPNOP;
/* Note, n->range has been multiplied by BITS_PER_UNIT in between, so it
needs to be divided by it again. */
if (n->range / BITS_PER_UNIT < (int) sizeof (int64_t))
{
mask = ((uint64_t) 1 << (n->range / BITS_PER_UNIT * BITS_PER_MARKER)) -
1;
cmpnop &= mask;
}
gcc_assert (n->n == cmpnop);
#endif
I think trusting find_bswap_or_nop did the job right is enough.
Ooops I meant check that if !base_addr then !bswap but that's already guaranteed
by the structure of the if. All good then.
Best regards,
Thomas