From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEb17-0003YL-Kj for qemu-devel@nongnu.org; Thu, 20 Sep 2012 03:17:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEb16-0007nV-Iz for qemu-devel@nongnu.org; Thu, 20 Sep 2012 03:17:45 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:42321) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TEb16-0007nP-9W for qemu-devel@nongnu.org; Thu, 20 Sep 2012 03:17:44 -0400 Message-ID: <505AC298.10506@gmx.de> Date: Thu, 20 Sep 2012 09:15:36 +0200 From: Ronald Hecht MIME-Version: 1.0 References: <1347974943-10029-1-git-send-email-ronald.hecht@gmx.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Added more entries to the LEON processor configuration register List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , chouteau@adacore.com On 09/19/2012 08:56 PM, Blue Swirl wrote: >> --- a/target-sparc/translate.c >> +++ b/target-sparc/translate.c >> @@ -2590,13 +2590,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) >> microSPARC II */ >> /* Read Asr17 */ >> if (rs1 == 0x11&& dc->def->features& CPU_FEATURE_ASR17) { >> - TCGv r_const; >> - >> - /* Read Asr17 for a Leon3 monoprocessor */ >> - r_const = tcg_const_tl((1<< 8) >> - | (dc->def->nwindows - 1)); >> - gen_movl_TN_reg(rd, r_const); >> - tcg_temp_free(r_const); >> + /* Read Asr17 on LEON3 */ >> + gen_helper_rdasr17(cpu_dst, cpu_env); >> > Is the register is read very often? If it is, we could avoid the > helper call by performing the load of env->cpu_index, the shift and OR > with the above constant with TCG ops. The arithmetic could be even > avoided completely by storing precalculated values in cpu_index, then > other accesses to cpu_index need to shift right by 28 to read the > index (depends on balance of other cpu_index uses vs. this > instruction). > The register is read quite often, but not as often as the PSR. It is normally read when entering the OS (Linux, PikeOS ...) Kernel to know on which CPU we are running a thread. But polluting the cpu_index in env sounds a bit strange and overkill to me. Do you really mean the cpu_index in the structure CPUSPARCState? Or could we place it in dc->def as a constant? Best regards, Ronald