Received: from eggs.gnu.org ([208.118.235.92]:53562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKvTY-0005pX-NL for qemu-devel@nongnu.org; Wed, 27 Mar 2013 14:53:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKvTU-0007Lq-Sf for qemu-devel@nongnu.org; Wed, 27 Mar 2013 14:53:32 -0400 Received: from mail-qc0-x22d.google.com ([2607:f8b0:400d:c01::22d]:38920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKvTU-0007Ll-Nl for qemu-devel@nongnu.org; Wed, 27 Mar 2013 14:53:28 -0400 Received: by mail-qc0-f173.google.com with SMTP id b12so2912289qca.32 for ; Wed, 27 Mar 2013 11:53:28 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Wed, 27 Mar 2013 11:52:33 -0700 Message-Id: <1364410353-24728-13-git-send-email-rth@twiddle.net> In-Reply-To: <1364410353-24728-1-git-send-email-rth@twiddle.net> References: <1364410353-24728-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 12/12] tcg-s390: Use all 20 bits of the offset in tcg_out_mem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: agraf@suse.de This can save one insn, if the constant has any bits in 32-63 set, but no bits in 21-31 set. It never results in more insns. Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c index 22927df..8e660b3 100644 --- a/tcg/s390/tcg-target.c +++ b/tcg/s390/tcg-target.c @@ -748,10 +748,11 @@ static void tcg_out_mem(TCGContext *s, S390Opcode opc_rx, S390Opcode opc_rxy, tcg_target_long ofs) { if (ofs < -0x80000 || ofs >= 0x80000) { - /* Combine the low 16 bits of the offset with the actual load insn; - the high 48 bits must come from an immediate load. */ - tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, ofs & ~0xffff); - ofs &= 0xffff; + /* Combine the low 20 bits of the offset with the actual load insn; + the high 44 bits must come from an immediate load. */ + tcg_target_long low = ((ofs & 0xfffff) ^ 0x80000) - 0x80000; + tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, ofs - low); + ofs = low; /* If we were already given an index register, add it in. */ if (index != TCG_REG_NONE) { -- 1.8.1.4