From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 0/8] Simplify byte/word opcode pair decode Date: Mon, 23 Aug 2010 17:13:26 +0300 Message-ID: <4C728206.9020007@redhat.com> References: <1282561577-24491-1-git-send-email-avi@redhat.com> <4C7277AE.3040102@redhat.com> <4C727C1A.3080204@redhat.com> <4C727FFE.8060806@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753621Ab0HWON2 (ORCPT ); Mon, 23 Aug 2010 10:13:28 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7NEDS3T019530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Aug 2010 10:13:28 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7NEDQPQ030711 for ; Mon, 23 Aug 2010 10:13:27 -0400 In-Reply-To: <4C727FFE.8060806@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/23/2010 05:04 PM, Paolo Bonzini wrote: > On 08/23/2010 03:48 PM, Avi Kivity wrote: >> On 08/23/2010 04:29 PM, Paolo Bonzini wrote: >>> On 08/23/2010 01:06 PM, Avi Kivity wrote: >>>> Many x86 instructions come in pairs - byte and word variants where >>>> bit 0 >>>> of the opcode determines operand size. Use this to simplify the decode >>>> tables. >>> >>> Many actually come in quadruples, bit 0 is the size and bit 1 says >>> which of ModRM and REG is the destination. >>> >>> example: >>> >>> D2bv(DstMem | SrcReg | ModRM | Lock), D2bv(DstReg | SrcMem | ModRM), >>> >> >> Right. We can't exploit those yet. > > What about this? It wouldn't work for things such as SrcAcc, but it > would still reap most of the benefit: > > #define D4modrm(x) \ > D2bv(DstMem | SrcReg | ModRM | (x)), \ > D2bv(DstReg | SrcMem | ModRM | ((x) & ~Lock)) > It's fine except for the name. "bv" stands for the single letter flags Intel gave to byte and word operations so it's somewhat descriptive. Maybe we could call it ALU4() and pretend that mov is an ALU instruction. We could also do an ALU6() for the ALU block. A really clever macro could probably compress the entire table into a single line. > e.g. > - ALU block -> D4modrm(Lock) > - 0x88-0x8b -> D4modrm(Mov) -- error compiling committee.c: too many arguments to function