Received: from [140.186.70.92] (port=45924 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q914m-0001L2-87 for qemu-devel@nongnu.org; Sun, 10 Apr 2011 16:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q914b-0007Xp-AC for qemu-devel@nongnu.org; Sun, 10 Apr 2011 16:17:30 -0400 Received: from cantor.suse.de ([195.135.220.2]:33415 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q914a-0007Xg-Vp for qemu-devel@nongnu.org; Sun, 10 Apr 2011 16:17:29 -0400 Subject: Re: [Qemu-devel] [PATCH 15/15] tcg: use ext op for deposit Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <20110410200812.GF4551@volta.aurel32.net> Date: Sun, 10 Apr 2011 22:17:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1301927544-32767-1-git-send-email-agraf@suse.de> <1301927544-32767-16-git-send-email-agraf@suse.de> <20110405045444.GH28617@hall.aurel32.net> <8E544975-03DA-484A-9768-41E2D1643074@suse.de> <20110410192302.GB4551@volta.aurel32.net> <986A40B3-391F-4B4F-B072-FE9F23B552BF@suse.de> <20110410200812.GF4551@volta.aurel32.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: peter.maydell@linaro.org, QEMU-devel Developers , Richard Henderson On 10.04.2011, at 22:08, Aurelien Jarno wrote: > On Sun, Apr 10, 2011 at 09:25:33PM +0200, Alexander Graf wrote: >>=20 >> On 10.04.2011, at 21:23, Aurelien Jarno wrote: >>=20 >>> On Tue, Apr 05, 2011 at 09:55:09AM +0200, Alexander Graf wrote: >>>>=20 >>>> On 05.04.2011, at 06:54, Aurelien Jarno wrote: >>>>=20 >>>>> On Mon, Apr 04, 2011 at 04:32:24PM +0200, Alexander Graf wrote: >>>>>> With the s390x target we use the deposit instruction to store = 32bit values >>>>>> into 64bit registers without clobbering the upper 32 bits. >>>>>>=20 >>>>>> This specific operation can be optimized slightly by using the = ext operation >>>>>> instead of an explicit and in the deposit instruction. This patch = adds that >>>>>> special case to the generic deposit implementation. >>>>>>=20 >>>>>> Signed-off-by: Alexander Graf >>>>>> --- >>>>>> tcg/tcg-op.h | 6 +++++- >>>>>> 1 files changed, 5 insertions(+), 1 deletions(-) >>>>>=20 >>>>> Have you really measuring a difference here? This should already = be >>>>> handled, at least on x86, by this code: >>>>>=20 >>>>> if (TCG_TARGET_REG_BITS =3D=3D 64) { >>>>> if (val =3D=3D 0xffffffffu) { >>>>> tcg_out_ext32u(s, r0, r0); >>>>> return; >>>>> } >>>>> if (val =3D=3D (uint32_t)val) { >>>>> /* AND with no high bits set can use a 32-bit = operation. */ >>>>> rexw =3D 0; >>>>> } >>>>> } >>>>=20 >>>> I've certainly looked at the -d op logs and seen that instead of = creating a const tcg variable plus an AND there was now an extu opcode = issued, yes. No idea why the case up there didn't trigger. >>>>=20 >>>=20 >>> The question there is looking at -d out_asm. They should be the same = at >>> the end as the code I pasted above is from tcg/i386/tcg-target.c. >>=20 >> Yes. I was trying to optimize for maximum op length. TCG defines a = maximum number of tcg ops to be issued by each target instruction. Since = s390 is very CISCy, there are instructions that translate into lots of = microops, but are still faster than a C call (register save/restore = mostly). >>=20 >> Without this patch, there are some places where we hit that number = :). >=20 > Is it on 32-bit on or 64-bit? If we reach this number, it's probably > better to either implement this instruction with an helper, or maybe > increase the number of maximum ops. What is this instruction? This was on x86_64. I hit limits with LMH and LM, but reduced them to = fit into the picture with this optimization :). If you like, I can give = you a statically linked binary that could exceed the limits. Alex