From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBH1z-0006rG-M9 for qemu-devel@nongnu.org; Mon, 28 Nov 2016 03:11:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBH1w-0004Vp-H6 for qemu-devel@nongnu.org; Mon, 28 Nov 2016 03:11:19 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:35701) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBH1w-0004VZ-AD for qemu-devel@nongnu.org; Mon, 28 Nov 2016 03:11:16 -0500 Received: by mail-pg0-x242.google.com with SMTP id p66so12468439pga.2 for ; Mon, 28 Nov 2016 00:11:16 -0800 (PST) Sender: Richard Henderson References: From: Richard Henderson Message-ID: Date: Mon, 28 Nov 2016 00:11:11 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 11/11] tcg-mips: Adjust condition functions for mips64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jin Guojie , Aurelien Jarno Cc: qemu-devel , James Hogan On 11/27/2016 11:42 PM, Jin Guojie wrote: > By reading Richard and Aurelien's comment, I realized now the best way to solve this problem > is not to add ext32s in brcond_32i, but to fix the helper function. In another word, > the register value should be 32-bit sign-extened at where it's being *created*, not where > it's being *utilized*. Maybe I can do this ext32s after helper_le_ld_name() is call back to ensure > V0 to be sign-extended. It's not necessarily V0 that needs to be extended, but the destination register (S1 in this case). So perhaps tcg_out_opc_br(s, OPC_BEQ, TCG_REG_ZERO, TCG_REG_ZERO); /* delay slot */ - tcg_out_mov(s, TCG_TYPE_REG, v0, TCG_REG_V0); + if (TCG_TARGET_REG_BITS == 64 && l->type == TCG_TYPE_I32) { + tcg_out_opc_sa(s, OPC_SLL, v0, TCG_REG_V0, 0); + } else { + tcg_out_opc_reg(s, OPC_OR, v0, TCG_REG_V0, TCG_REG_ZERO); + } so that we always sign-extend 32-bit loads. r~