From patchwork Fri Apr 5 18:47:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 234256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A24F02C00E7 for ; Sat, 6 Apr 2013 05:54:03 +1100 (EST) Received: from localhost ([::1]:39502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOBlx-00070K-Vr for incoming@patchwork.ozlabs.org; Fri, 05 Apr 2013 14:54:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOBgh-0005OQ-OF for qemu-devel@nongnu.org; Fri, 05 Apr 2013 14:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UOBge-0003su-L9 for qemu-devel@nongnu.org; Fri, 05 Apr 2013 14:48:35 -0400 Received: from mail-qe0-f42.google.com ([209.85.128.42]:54985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOBge-0003sn-HC for qemu-devel@nongnu.org; Fri, 05 Apr 2013 14:48:32 -0400 Received: by mail-qe0-f42.google.com with SMTP id cz11so2250198qeb.29 for ; Fri, 05 Apr 2013 11:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=cH0z71EDcUrhVeD26iLHh80CBNr7DpPA5lKRtzIG4Hs=; b=qtZoqi0eSZQwlra+v9ke+QVBFRbfIiVfUbDxUZX9w6K6L8X6vbwm2szOTZW2mUp1jd GEwJqjT+s5XMM40UrjzAMVmbupkuxgdlegeH4x68YynFRGNiqaobqCDtkJYsktP59Hkt 9lVJdFrQ9eAmKVSWfoTFUr5gMWmPBcqHqaCnPgwYiqTjyuAPCIlVxy8MtlmByXT661G5 l3V8dTG7bJSVjbrALEzZICTx8Skgjk1ZRy+7Br2NW6ItL7KZVIkKJVpLjzhkp3d69WdF UIZrFXFdnRdgM0hQr0V4HNCpxFe8C51cotg9q4DP3ITEVGLxtLkV7mRlQxdEy4xnN7vG WGvg== X-Received: by 10.49.0.67 with SMTP id 3mr10874572qec.9.1365187712115; Fri, 05 Apr 2013 11:48:32 -0700 (PDT) Received: from pebble.com (107-1-53-7-ip-static.hfc.comcastbusiness.net. [107.1.53.7]) by mx.google.com with ESMTPS id k8sm14592771qej.2.2013.04.05.11.48.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 05 Apr 2013 11:48:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 5 Apr 2013 13:47:40 -0500 Message-Id: <1365187661-17023-13-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1365187661-17023-1-git-send-email-rth@twiddle.net> References: <1365187661-17023-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.128.42 Cc: aliguori@us.ibm.com, aurelien@aurel32.net Subject: [Qemu-devel] [PULL v2 12/13] tcg-s390: Use all 20 bits of the offset in tcg_out_mem X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) {