[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] target/s390x: Fix CC set by CONVERT TO FIXED/LOGICAL

From: Richard Henderson
Subject: Re: [PATCH v3] target/s390x: Fix CC set by CONVERT TO FIXED/LOGICAL
Date: Wed, 30 Jun 2021 11:47:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 6/30/21 3:50 AM, Ulrich Weigand wrote:
The FP-to-integer conversion instructions need to set CC 3 whenever
a "special case" occurs; this is the case whenever the instruction
also signals the IEEE invalid exception.  (See e.g. figure 19-18
in the Principles of Operation.)

However, qemu currently will set CC 3 only in the case where the
input was a NaN.  This is indeed one of the special cases, but
there are others, most notably the case where the input is out
of range of the target data type.

This patch fixes the problem by switching these instructions to
the "static" CC method and computing the correct result directly
in the helper.  (It cannot be re-computed later as the information
about the invalid exception is no longer available.)

This fixes a bug observed when running the wasmtime test suite
under the s390x-linux-user target.

Signed-off-by: Ulrich Weigand<ulrich.weigand@de.ibm.com>
  target/s390x/fpu_helper.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---
  target/s390x/helper.h     | 24 +++++++++---------
  target/s390x/translate.c  | 39 +++++++++--------------------
  3 files changed, 83 insertions(+), 43 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]