From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v3 0/7] Streamline arithmetic instruction emulation Date: Tue, 8 Jan 2013 13:38:37 +0200 Message-ID: <20130108113837.GM21250@redhat.com> References: <1357309134-11944-1-git-send-email-avi.kivity@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42568 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754398Ab3AHLik (ORCPT ); Tue, 8 Jan 2013 06:38:40 -0500 Content-Disposition: inline In-Reply-To: <1357309134-11944-1-git-send-email-avi.kivity@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Jan 04, 2013 at 04:18:47PM +0200, Avi Kivity wrote: > The current arithmetic instruction emulation is fairly clumsy: after > decode, each instruction gets a switch (size), and for every size > we fetch the operands, prepare flags, emulate the instruction, then store > back the flags and operands. > > This patchset simplifies things by moving everything into common code > except the instruction itself. All the pre- and post- processing is > coded just once. The per-instrution code looks like: > > add %bl, %al > ret > > add %bx, %ax > ret > > add %ebx, %eax > ret > > add %rbx, %rax > ret > > The savings in size, for the ten instructions converted in this patchset, > are fairly large: > > text data bss dec hex filename > 63724 0 0 63724 f8ec arch/x86/kvm/emulate.o.before > 61268 0 0 61268 ef54 arch/x86/kvm/emulate.o.after > > - around 2500 bytes. > > v3: fix reversed operand order in 2-operand macro > > v2: rebased > Acked-by: Gleb Natapov -- Gleb.