Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lngn0-0003yD-0h for qemu-devel@nongnu.org; Sat, 28 Mar 2009 18:14:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lngmy-0003y1-HN for qemu-devel@nongnu.org; Sat, 28 Mar 2009 18:14:04 -0400 Received: from [199.232.76.173] (port=36906 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lngmy-0003xy-9C for qemu-devel@nongnu.org; Sat, 28 Mar 2009 18:14:04 -0400 Received: from hall.aurel32.net ([88.191.82.174]:45059) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lngmx-00018j-RH for qemu-devel@nongnu.org; Sat, 28 Mar 2009 18:14:04 -0400 Received: from 191.red-80-33-14.staticip.rima-tde.net ([80.33.14.191] helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Lngmw-0006eb-J9 for qemu-devel@nongnu.org; Sat, 28 Mar 2009 23:14:02 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1Lngmu-00052m-TA for qemu-devel@nongnu.org; Sat, 28 Mar 2009 23:14:00 +0100 Date: Sat, 28 Mar 2009 23:14:00 +0100 From: Aurelien Jarno Message-ID: <20090328221400.GA11874@volta.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Subject: [Qemu-devel] [RFC] [PATCH] tcg/x86_64: optimize register allocation order Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The beginning of the register allocation order list on the TCG x86_64 target matches the list of clobbered registers. This means that when an helper is called, there is almost always some registers to clobber. The same way register %rsi and %rdi are at the top of the register allocation order list, while they can't be used for load/store operations. This means the data and/or address registers are very often %rsi and %rdi, so a mov operation has to be inserted before and/or after doing the load/store. This patches changes to the allocation order to avoid those effects. It results in a 8% gain speed in qemu-x86_64 to compress a bzip2 file, and a 6% gain in qemu-system-mips64 to compile a small application. Signed-off-by: Aurelien Jarno diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c index 92f0733..5378e85 100644 --- a/tcg/x86_64/tcg-target.c +++ b/tcg/x86_64/tcg-target.c @@ -44,22 +44,21 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { #endif static const int tcg_target_reg_alloc_order[] = { - TCG_REG_RDI, - TCG_REG_RSI, - TCG_REG_RDX, - TCG_REG_RCX, - TCG_REG_R8, - TCG_REG_R9, - TCG_REG_RAX, - TCG_REG_R10, - TCG_REG_R11, - TCG_REG_RBP, TCG_REG_RBX, TCG_REG_R12, TCG_REG_R13, TCG_REG_R14, TCG_REG_R15, + TCG_REG_R10, + TCG_REG_R11, + TCG_REG_R9, + TCG_REG_R8, + TCG_REG_RCX, + TCG_REG_RDX, + TCG_REG_RSI, + TCG_REG_RDI, + TCG_REG_RAX, }; static const int tcg_target_call_iarg_regs[6] = { -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net