target/riscv: Introduce helper_set_rounding_mode_chkfrm
commit3ceeb19a53e51c0c6310d760d26dca08145797c5
authorRichard Henderson <richard.henderson@linaro.org>
Sun, 15 Jan 2023 16:06:56 +0000 (15 06:06 -1000)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 20 Jan 2023 00:14:14 +0000 (20 10:14 +1000)
treee847ad1a23b9a2af6155be8d65292cb7cf84dbab
parent9d9db41373a256c5ae011c1428d26d2597a77484
target/riscv: Introduce helper_set_rounding_mode_chkfrm

The new helper always validates the contents of FRM, even
if the new rounding mode is not DYN.  This is required by
the vector unit.

Track whether we've validated FRM separately from whether
we've updated fp_status with a given rounding mode, so that
we can elide calls correctly.

This partially reverts d6c4d3f2a69 which attempted the to do
the same thing, but with two calls to gen_set_rm(), which is
both inefficient and tickles an assertion in decode_save_opc.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1441
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230115160657.3169274-2-richard.henderson@linaro.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/fpu_helper.c
target/riscv/helper.h
target/riscv/insn_trans/trans_rvv.c.inc
target/riscv/translate.c