Received: from eggs.gnu.org ([2001:4830:134:3::10]:50562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPeo-0006vl-4O for qemu-devel@nongnu.org; Sat, 21 Dec 2013 11:44:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuPef-0006MI-KN for qemu-devel@nongnu.org; Sat, 21 Dec 2013 11:44:06 -0500 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:46492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuPef-0006LM-Dw for qemu-devel@nongnu.org; Sat, 21 Dec 2013 11:43:57 -0500 From: Aurelien Jarno Date: Sat, 21 Dec 2013 17:43:41 +0100 Message-Id: <1387644224-2404-3-git-send-email-aurelien@aurel32.net> In-Reply-To: <1387644224-2404-1-git-send-email-aurelien@aurel32.net> References: <1387644224-2404-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 2/5] tcg/i386: remove hardcoded P_REXW value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno P_REXW is defined has a constant at the beginning of i386/tcg-target.c, but the corresponding bit is later used in a harcoded way, which defeat the purpose of a constant. Fix that by using a conditional expression operator instead of a shift. On x86 this actually makes the code slightly smaller as GCC does in practice (opc >> 8) & 8 instead of (opc & 0x800) >> 8 so the constants are smaller to load. Signed-off-by: Aurelien Jarno --- tcg/i386/tcg-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index 495b901..753b3a1 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -381,7 +381,7 @@ static void tcg_out_opc(TCGContext *s, int opc, int r, int rm, int x) } rex = 0; - rex |= (opc & P_REXW) >> 8; /* REX.W */ + rex |= (opc & P_REXW) ? 0x8 : 0x0; /* REX.W */ rex |= (r & 8) >> 1; /* REX.R */ rex |= (x & 8) >> 2; /* REX.X */ rex |= (rm & 8) >> 3; /* REX.B */ -- 1.7.10.4