[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/6] target/riscv: Use env_archcpu() in [check_]nanbox()
From: |
Richard W.M. Jones |
Subject: |
Re: [PATCH 2/6] target/riscv: Use env_archcpu() in [check_]nanbox() |
Date: |
Mon, 9 Oct 2023 13:53:51 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Oct 09, 2023 at 01:02:35PM +0200, Philippe Mathieu-Daudé wrote:
> When CPUArchState* is available (here CPURISCVState*), we
> can use the fast env_archcpu() macro to get ArchCPU* (here
> RISCVCPU*). The QOM cast RISCV_CPU() macro will be slower
> when building with --enable-qom-cast-debug.
>
> Inspired-by: Richard W.M. Jones <rjones@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/riscv/internals.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/target/riscv/internals.h b/target/riscv/internals.h
> index b5f823c7ec..8239ae83cc 100644
> --- a/target/riscv/internals.h
> +++ b/target/riscv/internals.h
> @@ -87,7 +87,7 @@ enum {
> static inline uint64_t nanbox_s(CPURISCVState *env, float32 f)
> {
> /* the value is sign-extended instead of NaN-boxing for zfinx */
> - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) {
> + if (env_archcpu(env)->cfg.ext_zfinx) {
> return (int32_t)f;
> } else {
> return f | MAKE_64BIT_MASK(32, 32);
> @@ -97,7 +97,7 @@ static inline uint64_t nanbox_s(CPURISCVState *env, float32
> f)
> static inline float32 check_nanbox_s(CPURISCVState *env, uint64_t f)
> {
> /* Disable NaN-boxing check when enable zfinx */
> - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) {
> + if (env_archcpu(env)->cfg.ext_zfinx) {
> return (uint32_t)f;
> }
>
> @@ -113,7 +113,7 @@ static inline float32 check_nanbox_s(CPURISCVState *env,
> uint64_t f)
> static inline uint64_t nanbox_h(CPURISCVState *env, float16 f)
> {
> /* the value is sign-extended instead of NaN-boxing for zfinx */
> - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) {
> + if (env_archcpu(env)->cfg.ext_zfinx) {
> return (int16_t)f;
> } else {
> return f | MAKE_64BIT_MASK(16, 48);
> @@ -123,7 +123,7 @@ static inline uint64_t nanbox_h(CPURISCVState *env,
> float16 f)
> static inline float16 check_nanbox_h(CPURISCVState *env, uint64_t f)
> {
> /* Disable nanbox check when enable zfinx */
> - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) {
> + if (env_archcpu(env)->cfg.ext_zfinx) {
> return (uint16_t)f;
> }
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
- [PATCH 0/6] target: Use env_archcpu() instead of ARCH_CPU(env_cpu(env)), Philippe Mathieu-Daudé, 2023/10/09
- [PATCH 1/6] target/ppc: Use env_archcpu() in helper_book3s_msgsndp(), Philippe Mathieu-Daudé, 2023/10/09
- [PATCH 2/6] target/riscv: Use env_archcpu() in [check_]nanbox(), Philippe Mathieu-Daudé, 2023/10/09
- [PATCH 4/6] target/xtensa: Use env_archcpu() in update_c[compare|count](), Philippe Mathieu-Daudé, 2023/10/09
- [PATCH 3/6] target/s390x: Use env_archcpu() in handle_diag_308(), Philippe Mathieu-Daudé, 2023/10/09
- [PATCH 5/6] target/i386/hvf: Use x86_cpu in simulate_[rdmsr|wrmsr](), Philippe Mathieu-Daudé, 2023/10/09
- [PATCH 6/6] target/i386: Use env_archcpu() in simulate_[rdmsr/wrmsr](), Philippe Mathieu-Daudé, 2023/10/09