From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZINT2-0004Cm-5A for qemu-devel@nongnu.org; Thu, 23 Jul 2015 16:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZINSy-0003E4-UN for qemu-devel@nongnu.org; Thu, 23 Jul 2015 16:51:48 -0400 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:36531) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZINSy-0003Dp-Q5 for qemu-devel@nongnu.org; Thu, 23 Jul 2015 16:51:44 -0400 Received: by qkdv3 with SMTP id v3so2846103qkd.3 for ; Thu, 23 Jul 2015 13:51:44 -0700 (PDT) Sender: Richard Henderson References: <1436972709-5860-1-git-send-email-aurelien@aurel32.net> From: Richard Henderson Message-ID: <55B153DC.6010307@twiddle.net> Date: Thu, 23 Jul 2015 13:51:40 -0700 MIME-Version: 1.0 In-Reply-To: <1436972709-5860-1-git-send-email-aurelien@aurel32.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] target-mips: simplify LWL/LDL mask generation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno , qemu-devel@nongnu.org Cc: Leon Alrae On 07/15/2015 08:05 AM, Aurelien Jarno wrote: > The LWL/LDL instructions mask the GPR with a mask depending on the > address alignement. It is currently computed by doing: > > mask = 0x7fffffffffffffffull >> (t1 ^ 63) > > It's simpler to generate it by doing: > > mask = ~(-1 << t1) > > It uses one TCG instruction less, and it avoids a 32/64-bit constant > loading which can take a few instructions on RISC hosts. > > Cc: Leon Alrae > Signed-off-by: Aurelien Jarno > --- > target-mips/translate.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > Changes v1 -> v2: > - Use ~(-1 << t1) instead of (1 << t1) - 1 as suggested by Paolo > Bonzini. Reviewed-by: Richard Henderson r~