qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: peter.maydell@linaro.org,
	QEMU-devel Developers <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 15/15] tcg: use ext op for deposit
Date: Thu, 14 Apr 2011 18:27:08 +0200	[thread overview]
Message-ID: <4DA7205C.8000204@suse.de> (raw)
In-Reply-To: <20110410202817.GJ4551@volta.aurel32.net>

On 04/10/2011 10:28 PM, Aurelien Jarno wrote:
> On Sun, Apr 10, 2011 at 10:17:26PM +0200, Alexander Graf wrote:
>> On 10.04.2011, at 22:08, Aurelien Jarno wrote:
>>
>>> On Sun, Apr 10, 2011 at 09:25:33PM +0200, Alexander Graf wrote:
>>>> On 10.04.2011, at 21:23, Aurelien Jarno wrote:
>>>>
>>>>> On Tue, Apr 05, 2011 at 09:55:09AM +0200, Alexander Graf wrote:
>>>>>> On 05.04.2011, at 06:54, Aurelien Jarno wrote:
>>>>>>
>>>>>>> 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.
>>>>>>>>
>>>>>>>> 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.
>>>>>>>>
>>>>>>>> Signed-off-by: Alexander Graf<agraf@suse.de>
>>>>>>>> ---
>>>>>>>> tcg/tcg-op.h |    6 +++++-
>>>>>>>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>>>>>> Have you really measuring a difference here? This should already be
>>>>>>> handled, at least on x86, by this code:
>>>>>>>
>>>>>>>       if (TCG_TARGET_REG_BITS == 64) {
>>>>>>>           if (val == 0xffffffffu) {
>>>>>>>               tcg_out_ext32u(s, r0, r0);
>>>>>>>               return;
>>>>>>>           }
>>>>>>>           if (val == (uint32_t)val) {
>>>>>>>               /* AND with no high bits set can use a 32-bit operation.  */
>>>>>>>               rexw = 0;
>>>>>>>           }
>>>>>>>       }
>>>>>> 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.
>>>>>>
>>>>> 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.
>>>> 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).
>>>>
>>>> Without this patch, there are some places where we hit that number :).
>>> 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.
>>
> Yeah for what I see it's the loop is unrolled there. Not sure it is the
> best to do. Also if the limit is exceeded on 64-bit it is for sure
> exceeded on 32-bit hosts.


Ok, I've optimized some code paths for 32bit hosts now and bumped up the 
limit on 32bit to 128 ops. I've also dropped the ext op patch - it's not 
necessary anymore. I've optimized the 64bit version well enough so we 
don't require it anymore :)


Alex

      reply	other threads:[~2011-04-14 16:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 14:32 [Qemu-devel] [PATCH 00/15] s390x emulation support v3 Alexander Graf
2011-04-04 14:32 ` [Qemu-devel] [PATCH 01/15] s390x: fix virtio feature bitmap Alexander Graf
2011-04-10 19:25   ` Aurelien Jarno
2011-04-10 19:26     ` Alexander Graf
2011-04-10 20:06       ` Aurelien Jarno
2011-04-10 20:11         ` Alexander Graf
2011-04-10 20:26           ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 02/15] s390x: set alignment for long to 8 Alexander Graf
2011-04-10 19:25   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 03/15] s390x: s390x-linux-user support Alexander Graf
2011-04-10 20:16   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 04/15] linux-user: define a couple of syscalls for non-uid16 targets Alexander Graf
2011-04-10 20:25   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 05/15] s390x: Enable s390x-softmmu target Alexander Graf
2011-04-10 20:34   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 06/15] s390x: Dispatch interrupts to KVM or the real CPU Alexander Graf
2011-04-10 20:37   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 07/15] s390x: Adjust GDB stub Alexander Graf
2011-04-10 20:39   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 08/15] s390x: virtio machine storage keys Alexander Graf
2011-04-10 20:41   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 09/15] s390x: Prepare cpu.h for emulation Alexander Graf
2011-04-12 21:32   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 10/15] s390x: helper functions for system emulation Alexander Graf
2011-04-12 21:32   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 11/15] s390x: Implement opcode helpers Alexander Graf
2011-04-12 21:32   ` Aurelien Jarno
2011-04-13  5:20     ` Alexander Graf
2011-04-04 14:32 ` [Qemu-devel] [PATCH 12/15] s390x: Adjust internal kvm code Alexander Graf
2011-04-12 21:32   ` Aurelien Jarno
2011-04-04 14:32 ` [Qemu-devel] [PATCH 13/15] s390x: translate engine for s390x CPU Alexander Graf
2011-04-04 14:32 ` [Qemu-devel] [PATCH 14/15] s390x: build s390x by default Alexander Graf
2011-04-04 14:32 ` [Qemu-devel] [PATCH 15/15] tcg: use ext op for deposit Alexander Graf
2011-04-05  4:54   ` Aurelien Jarno
2011-04-05  7:55     ` Alexander Graf
2011-04-10 19:23       ` Aurelien Jarno
2011-04-10 19:25         ` Alexander Graf
2011-04-10 20:08           ` Aurelien Jarno
2011-04-10 20:17             ` Alexander Graf
2011-04-10 20:28               ` Aurelien Jarno
2011-04-14 16:27                 ` Alexander Graf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA7205C.8000204@suse.de \
    --to=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).