]> git.ipfire.org Git - thirdparty/valgrind.git/commit
Bug 502324 - s390x: Fix memcheck false positives with TMxx
authorAndreas Arnez <arnez@linux.ibm.com>
Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)
commita95ba0d6e549764d5a68536efc6eb1545b537c09
tree6c4c764a59923bc6988d8adcd3667e9ebc88d678
parent07fc84abb78a161542e4fea7435c1184ccb6ecd7
Bug 502324 - s390x: Fix memcheck false positives with TMxx

The 16-bit "test under mask" instructions TMLL, TMLH, TMHL, and TMHH can
yield memcheck false positives when:

* some of the operand bits in the tested 16-bit chunk (but outside the
  mask) are undefined

* the resulting condition code is used in a different block

In this case the condition code is computed by the helper
s390_call_calculate_cond, with the full 16-bit chunk and the given mask as
arguments.  Since the 16-bit chunk is not fully defined, memcheck
complains.

To fix this, AND the operand with the given mask before storing it for use
as a helper argument.  Also, optimize the frequent case of testing a
single bit.  For this purpose, add S390_CC_OP_BITWISE2 as a new way of
computing the condition code.
VEX/priv/guest_s390_defs.h
VEX/priv/guest_s390_helpers.c
VEX/priv/guest_s390_toIR.c