From: Carl Love Date: Fri, 22 Mar 2019 17:32:29 +0000 (-0500) Subject: PPC64, The function _get_maxmin_fp_NaN does not handle the case of QNaN, SNaN correctly. X-Git-Tag: VALGRIND_3_15_0~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9986500957ae53ef6374e86938188bca4d1c6df;p=thirdparty%2Fvalgrind.git PPC64, The function _get_maxmin_fp_NaN does not handle the case of QNaN, SNaN correctly. This patch fixes Valgrind to handle the case of QNaN, SNaN input the same as the HW handles it. Valgrind bug 405365. --- diff --git a/NEWS b/NEWS index fe30a0f7de..a18d3406ab 100644 --- a/NEWS +++ b/NEWS @@ -117,6 +117,8 @@ where XXXXXX is the bug number as listed below. the upper and lower 32-bits of the 64-bit result 405362 PPC64, vmsummbm instruction doesn't handle overflow case correctly 405363 PPC64, xvcvdpsxws, xvcvdpuxws, do not handle NaN arguments correctly. +405365 PPC64, function _get_maxmin_fp_NaN() doesn't handle QNaN, SNaN case + correctly. n-i-bz add syswrap for PTRACE_GET|SET_THREAD_AREA on amd64. n-i-bz Fix callgrind_annotate non deterministic order for equal total diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c index d40de2da92..3725e6ae9c 100644 --- a/VEX/priv/guest_ppc_toIR.c +++ b/VEX/priv/guest_ppc_toIR.c @@ -17485,7 +17485,10 @@ static IRExpr * _get_maxmin_fp_NaN(IRTemp frA_I64, IRTemp frB_I64) * if frA is a SNaN * result = frA converted to QNaN * else if frB is a SNaN - * result = frB converted to QNaN + * if (frA is QNan) + * result = frA + * else + * result = frB converted to QNaN * else if frB is a QNaN * result = frA * // One of frA or frB was a NaN in order for this function to be called, so @@ -17496,14 +17499,19 @@ static IRExpr * _get_maxmin_fp_NaN(IRTemp frA_I64, IRTemp frB_I64) */ #define SNAN_MASK 0x0008000000000000ULL + return - IRExpr_ITE(mkexpr(frA_isSNaN), + IRExpr_ITE(mkexpr(frA_isSNaN), /* then: result = frA converted to QNaN */ binop(Iop_Or64, mkexpr(frA_I64), mkU64(SNAN_MASK)), /* else: if frB is a SNaN */ IRExpr_ITE(mkexpr(frB_isSNaN), - /* then: result = frB converted to QNaN */ - binop(Iop_Or64, mkexpr(frB_I64), mkU64(SNAN_MASK)), + IRExpr_ITE(mkexpr(frA_isQNaN), + /* then: result = frA */ + mkexpr(frA_I64), + /* else: result = frB converted to QNaN */ + binop(Iop_Or64, mkexpr(frB_I64), + mkU64(SNAN_MASK))), /* else: if frB is a QNaN */ IRExpr_ITE(mkexpr(frB_isQNaN), /* then: result = frA */