From patchwork Fri Nov 23 14:45:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 151913 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2249361ljp; Fri, 23 Nov 2018 07:18:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ui9e2tuCITbRPBBLHA0omH3z2ltwmt0QcmFfcoBq3RRcQJk6YGF513kmUzugUZCO669OPZ X-Received: by 2002:a81:4506:: with SMTP id s6mr12246932ywa.200.1542986319560; Fri, 23 Nov 2018 07:18:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542986319; cv=none; d=google.com; s=arc-20160816; b=qxIRAtCx5SZyOcCEIoYOQ1qzeF1Yj701oslpzJ/tVx5GUMVo0RALVkvrrLLvbE4C52 ULDydAFsNBdoPFsELVsbbhSaAQmhU4M0uPX+Gh/FEzQrIkmKG502Cuj/gdcjd3ap7VEA H5lvCxECCyFxnnQtrJGv6BQgdYz/2ZdPdYzqeBNCUZR1ka5cHHU+T+DBhinsbdauyw9x OxvpJ/f6WLVRuse0ad97zR8ZPkmbREsH4sNWo4tMGhX/Q8dRnb7P/tdgr3PsWepG7w4I t3zo35P9a0cSMq4EUMfKpinUj9gEZtq85AK7eXkyVkNpm9J3Z7Qi1AKQYr55rAQce8L/ pBQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ftMZ3fz35dYKoMc8uTCKp7fh8kUWUt+B2yZR69ArZfM=; b=Xja7UjuqCSBnEX31g37RLouHMV5EF+6SS+cDL/jcb8ZUGqXrgZPaQg/oR0p4XaNMyo jc49kwAfsOuXzJu0JsoykDx9e8PgtNxG/xRuZRtohLLPuKW70usTmYofjwgjSiZ8I7yx oP5Q4RaPOp8kw/yulE1eLOY2vtFoHkJtuysQWKjbJYbq4U3rnvVKieHJOw2R/UCWd74d EyfO9DBs9XdcFRdkgQqmCWGqSFjpOuPbkeKFSWDUyepJDIs5/kT+tSrP2UKbeYN/Apl6 KQH0N0sxTOyZMf9B9ZAoZ9ctB4516rnbQ3Zb2xgeebLx7EncuvkvZbFsSo+rgEfXGF0c OwJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=C0BGPmG6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x143si19714901ywg.78.2018.11.23.07.18.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Nov 2018 07:18:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=C0BGPmG6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQDE6-0006GL-UL for patch@linaro.org; Fri, 23 Nov 2018 10:18:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQCj6-0000Hj-RR for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQCj4-0003lo-Su for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:35 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:32861) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQCj4-0003iu-Ki for qemu-devel@nongnu.org; Fri, 23 Nov 2018 09:46:34 -0500 Received: by mail-wr1-x441.google.com with SMTP id c14so6956475wrr.0 for ; Fri, 23 Nov 2018 06:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ftMZ3fz35dYKoMc8uTCKp7fh8kUWUt+B2yZR69ArZfM=; b=C0BGPmG6ZXBTup7b6ZlFpG2gESXyr8l9FLstYIP3caLxWVWfHSORxi2HxlHukoBBPZ nO9PZm+GlHFTkbaHzi8H8/xDaOY9kzlCpZeARg4JlNQHG5VQHEvBD75FWesXxJHMYb3a AXjqKLRSMpONusJU1PlZXBwcvMeQXeyqkj3YM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ftMZ3fz35dYKoMc8uTCKp7fh8kUWUt+B2yZR69ArZfM=; b=kL+YF60s8HhqVFVG63A2xMq+tr/dQQrYgBVZBiUu+u9EWaCOt3GIUtpKxTwz63FmzJ gABFqo7O80sffTFIBCsdnTHtzG1PPgGs8Bb86bZBHNMtfos30WlbI+iSMqLO7TtOKhBX q/ti3oPKeqgpBfuZ05wKPTo/fnuNI6P2YadgG11q1vsi+x/0EPNwxo3bcYBiPQ2DzD1G xCUfhBi+LaaEUxZTCihQWYKLMSalO15/fwiMl+Oin3UdPPxNlVg03xXbi5mL8veu6w08 S6t1mJFKrpHe2N3VCsOOC51liXqgEIWvi15ejHg61hV2KioP+4yP1uhxqhNw/vBn+1G3 BZCQ== X-Gm-Message-State: AA+aEWYPCssV25770aJmpPDqwYYisVAh4aWHAg5DNTPe1PsiAX/a/9xg d82rkg0srbh1Oz1eXywG2wtRiT+jRT2J4g== X-Received: by 2002:adf:c888:: with SMTP id k8mr15339977wrh.6.1542984392410; Fri, 23 Nov 2018 06:46:32 -0800 (PST) Received: from cloudburst.twiddle.net ([195.77.246.50]) by smtp.gmail.com with ESMTPSA id p74sm10339630wmd.29.2018.11.23.06.46.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Nov 2018 06:46:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2018 15:45:54 +0100 Message-Id: <20181123144558.5048-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181123144558.5048-1-richard.henderson@linaro.org> References: <20181123144558.5048-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH for-4.0 v2 33/37] tcg/i386: Propagate is64 to tcg_out_qemu_ld_direct X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair.Francis@wdc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This can save a few rex prefixes for qemu_ld_i32. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) -- 2.17.2 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 76235e90c9..5cad31cfe5 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -1815,10 +1815,11 @@ static inline void setup_guest_base_seg(void) { } static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, TCGReg base, int index, intptr_t ofs, - int seg, TCGMemOp memop) + int seg, bool is64, TCGMemOp memop) { bool use_bswap = memop & MO_BSWAP; bool use_movbe = false; + int rexw = is64 * P_REXW; int movop = OPC_MOVL_GvEv; /* @@ -1843,7 +1844,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, base, index, 0, ofs); break; case MO_SB: - tcg_out_modrm_sib_offset(s, OPC_MOVSBL + P_REXW + seg, datalo, + tcg_out_modrm_sib_offset(s, OPC_MOVSBL + rexw + seg, datalo, base, index, 0, ofs); break; case MO_UW: @@ -1871,14 +1872,15 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, if (use_movbe) { tcg_out_modrm_sib_offset(s, OPC_MOVBE_GyMy + P_DATA16 + seg, datalo, base, index, 0, ofs); - tcg_out_ext16s(s, datalo, datalo, P_REXW); - } else { - tcg_out_modrm_sib_offset(s, OPC_MOVSWL + P_REXW + seg, + tcg_out_ext16s(s, datalo, datalo, rexw); + } else if (use_bswap) { + tcg_out_modrm_sib_offset(s, OPC_MOVSWL + seg, + datalo, base, index, 0, ofs); + tcg_out_rolw_8(s, datalo); + tcg_out_ext16s(s, datalo, datalo, rexw); + } else { + tcg_out_modrm_sib_offset(s, OPC_MOVSWL + rexw + seg, datalo, base, index, 0, ofs); - if (use_bswap) { - tcg_out_rolw_8(s, datalo); - tcg_out_ext16s(s, datalo, datalo, P_REXW); - } } break; case MO_UL: @@ -2004,7 +2006,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is64) } tcg_out_qemu_ld_direct(s, datalo, datahi, - base, index, offset, seg, opc); + base, index, offset, seg, is64, opc); } #endif } @@ -2202,7 +2204,7 @@ static tcg_insn_unit *tcg_out_qemu_ldst_ool(TCGContext *s, bool is_ld, /* TLB Hit. */ if (is_ld) { - tcg_out_qemu_ld_direct(s, datalo, datahi, base, -1, 0, 0, opc); + tcg_out_qemu_ld_direct(s, datalo, datahi, base, -1, 0, 0, is_64, opc); } else { tcg_out_qemu_st_direct(s, datalo, datahi, base, 0, 0, opc); }