]> git.ipfire.org Git - thirdparty/valgrind.git/commit
memcheck powerpc subfe x, x, x initializes x to 0 or -1 based on CA
authorMark Wielaard <mark@klomp.org>
Thu, 21 Feb 2019 16:21:53 +0000 (17:21 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 21 Feb 2019 16:21:53 +0000 (17:21 +0100)
commit256cf43c5eadb28edb45436aca6fda8ee55eb10e
tree7d780705a1d1ea2237598de69328d4c2ed7f343f
parentde7fc1a0593ca94835bba5f9732997b355055c4b
memcheck powerpc subfe x, x, x initializes x to 0 or -1 based on CA

GCC might use subfe x, x, x to initialize x to 0 or -1, based on
whether the carry flag is set. This happens in some cases when g++
compiles resetting a unique_ptr. The "trick" used by the compiler is
that it can AND a pointer with the register x (now 0x0 or 0xffffffff)
to set something to NULL or to the given pointer.

subfe is implemented as rD = (log not)rA + rB + XER[CA]
if we instead implement it as rD = rB - rA - (XER[CA] ^ 1)
then memcheck can see that rB and Ra cancel each other out if they
are the same.

https://bugs.kde.org/show_bug.cgi?id=404054
NEWS
VEX/priv/guest_ppc_toIR.c