From patchwork Mon Oct 9 11:02:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 730998 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1144187wrw; Mon, 9 Oct 2023 04:05:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGpP1NWOsOKV88VVBMDYyuo1Dcs40YPQFJcQ6lv0y5i9bpX0TtowXxZ4Y7pVOomekT1wOy X-Received: by 2002:a05:622a:511:b0:418:1c31:dada with SMTP id l17-20020a05622a051100b004181c31dadamr19150809qtx.31.1696849515858; Mon, 09 Oct 2023 04:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696849515; cv=none; d=google.com; s=arc-20160816; b=JC6cnKrIxbSb6oa2jaUZ2LbRky5Iwiy7Yng9XVZDNKo4bWJ4yWNZJ4gCipudqQMCXx ydmcvfN25KR/sRIHL4c+iTF6vgDGWVo7I1HY8gLQGgf+3UDzEFgJzvBtzuAPD3lkvNy1 GUe9+J2EH5CFPNYJVQh5KRFpbUyha0MkJXEdmu1WK3UOSto8IUfclsULN0RfOBNccG3N 4Q/FQd6tOZDmdOFqiPFgGoRhkBY9A971AVa4ONa44shdauMWGoLknCi/iTo5kMYR7Ghd IE1hv0kd4rvwYyB7Lkcktad1qvtQsGWsqrptslqSrv0WdfvxnnH29rUlkpHZCv9SP8zZ tMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y/GrMBIMGrTYySZAmzh8zKw+DxTy0unUed7WlZuT/J4=; fh=wq6daNeLzc36HdDrkgSBcXIGbQaPjVJAVVw2fTIkOkc=; b=NF3X8XnQtbW2GvwJC39eetcLyvuE+862uCKpXGYL9/GHL/p/k4+dxP/bGsTuaXD1YD Hh9butWAMvrK/2076I69mHix5VmBsD3lJnEGGzPnSy1u7/1ANvsyJcQHeylK+Q0dXWAl dWuAIfirPyH9RNHKT5tsXj8aXW/M3mra/58k11PqTxtNTU82JjKmveMxLbOh0fidguIB Cpe65NZfY772d8a6hq5ue7+R4jw8Le2uDtctLFnjWoTg5LJGMfwL4UYNzWildgxtNDYN wLuRYXkuBAgJyVTVRxd+9o9pOQATrIuNXfAe/Z57nt9NGRt4AnYXXQcJLiZoo7SyaZb4 ovtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=INvojKDd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n17-20020a05622a11d100b00417fd10f754si6036502qtk.412.2023.10.09.04.05.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Oct 2023 04:05:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=INvojKDd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo2n-0006Xf-Uu; Mon, 09 Oct 2023 07:03:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2S-0006IM-FS for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:06 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2M-0003N7-PH for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:01 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-99c1c66876aso797702366b.2 for ; Mon, 09 Oct 2023 04:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849376; x=1697454176; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y/GrMBIMGrTYySZAmzh8zKw+DxTy0unUed7WlZuT/J4=; b=INvojKDd9QmyIFhMnCKSaTj9DMmu6US/JLwSPhix28eesJzzWNjkIn7qwuhhkdXXyX Ob6jpY7ZgBjZa3bi9nZm5K7gDQVP5nD12ICTszBcSmNXQvZh5k9Gm5IWfyP+ZUoqftvf D66xReS5plsakXH5RP7QQPJVqfWNRBzFAT6qPsnj3K1dp2eSs6IeG/6QZtJJ6wn8rabZ i+OcfQwgvY5NNm+2p4jCM/N1NUKREWBqdEX02hgrR9gTct5GbKR7SUikKzSQ/NPLPLGM pkJbn1TV1aB4GeGk4u5K42ObbYMD90V2spFT0CgNa2xNTlWNpuA8Ib6u9FFyd83ZafWM CChA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849376; x=1697454176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y/GrMBIMGrTYySZAmzh8zKw+DxTy0unUed7WlZuT/J4=; b=EzF0rxC+AjnpM+wAJkj3pTPxTlBp+cZPcdeANF/PcNleW2eCcoiXdyufZC0FwnmaWl Mgs/nMljsZ2KFTtygxshrthwwRHIHM3Ci/V2fzYU1im4DXVwYnuSB7bEXRa0SzlTCPCR irCudgVwJAUqx82uCXOI/PeoQ+jjwTM9AqZPLuKuKSZfYSPbV9nLOtEr5OkID6jvuPNL 2HGxGh0DVw+7EnHDbOHonRWAJgGrJALmpNkOdP+buVQClYl03+NtYNq4qEwvQLAi2SDw 58XR/AnZUIG4LbmBGjO321TZz4zLn5MWTdrMn95vRtU/ZJiJpnEEtg5RwMYvCKq62TcK 2B5Q== X-Gm-Message-State: AOJu0YzqzVu6jcYtMK4Bo5bcfqEEG4m3ObGDXG32RE2LXHxq3bx2U6Qh rH+EWv3EivbR8tCWRqua8JRC6BLs0BPc5CIx1WI= X-Received: by 2002:a17:906:845c:b0:9b8:f17a:fbc3 with SMTP id e28-20020a170906845c00b009b8f17afbc3mr11624536ejy.64.1696849375915; Mon, 09 Oct 2023 04:02:55 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id y18-20020a170906559200b009ad75d318ffsm6699191ejp.17.2023.10.09.04.02.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:02:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Richard W . M . Jones" Subject: [PATCH 2/6] target/riscv: Use env_archcpu() in [check_]nanbox() Date: Mon, 9 Oct 2023 13:02:35 +0200 Message-ID: <20231009110239.66778-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: LIU Zhiwei Reviewed-by: Richard W.M. Jones Reviewed-by: Alistair Francis --- 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; }