On Wed, Jun 30 2021, Ulrich Weigand <ulrich.weig...@de.ibm.com> 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.weig...@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(-) Thanks, applied.