From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB076E95A8E for ; Mon, 9 Oct 2023 12:54:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpplo-0005Xp-Jg; Mon, 09 Oct 2023 08:54:00 -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 1qppln-0005X9-9n for qemu-devel@nongnu.org; Mon, 09 Oct 2023 08:53:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qppll-0000aN-EB for qemu-devel@nongnu.org; Mon, 09 Oct 2023 08:53:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696856036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0r9ewgTsFIQHpkLpuDb+1vMuNEf+WCs5hSFB4QbUeFg=; b=gTGnseab7uBtdqxHD+UTjQzNFhyS20zpJ7zMY1n1NjGWHRt7oeoeEhDLIAKtS0DmIH6rOT 0ATgQlVSEyOPsbfvD7O8iFu8p4nzPwqWKjHUmpkbH6WSWvcqNi+uVpAi8MU/khSi7OxD6Y Mv2RBlulJMkYS9QHXpGe1ya9qCneWrs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-6r6QAPYANT2JHmUTIqCZ9w-1; Mon, 09 Oct 2023 08:53:53 -0400 X-MC-Unique: 6r6QAPYANT2JHmUTIqCZ9w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2EEF29AA3BD; Mon, 9 Oct 2023 12:53:52 +0000 (UTC) Received: from localhost (unknown [10.42.28.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BEAE215670B; Mon, 9 Oct 2023 12:53:52 +0000 (UTC) Date: Mon, 9 Oct 2023 13:53:51 +0100 From: "Richard W.M. Jones" To: Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= Cc: qemu-devel@nongnu.org, 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 , =?iso-8859-1?Q?C=E9dric?= Le Goater , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin Subject: Re: [PATCH 2/6] target/riscv: Use env_archcpu() in [check_]nanbox() Message-ID: <20231009125351.GS7636@redhat.com> References: <20231009110239.66778-1-philmd@linaro.org> <20231009110239.66778-3-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231009110239.66778-3-philmd@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass client-ip=170.10.133.124; envelope-from=rjones@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 > Signed-off-by: Philippe Mathieu-Daudé > --- > 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 -- 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