From patchwork Tue Nov 20 12:15:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 151577 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp535911ljp; Tue, 20 Nov 2018 04:21:14 -0800 (PST) X-Google-Smtp-Source: AJdET5euDdzWqotcZxY7ajgbJ2X2NZJOamN2DSLrpUocwylKdBaekBrcbRZGThzy7bsiFSUBY1+X X-Received: by 2002:a81:88c3:: with SMTP id y186-v6mr1461342ywf.395.1542716474080; Tue, 20 Nov 2018 04:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542716474; cv=none; d=google.com; s=arc-20160816; b=KtM5jlIojGqzw+dC1be+s/9tPn2bAaahw0VLqiY9+FjyS3dTQiTplUFruoRpNWN8QX NoRiFZ0FwVuWjtlsk5IEKqfCmM+9+AZoXQL7zc9SqkqjvfQ6EneZFpXgCaPwFG+5p2FM VIjzoTs5uJdLTohQ3dWQFlvX6GaZ2XfnvpFWWzNdGulFbBu7MWqe2lcHP6xsmDOinT4l C+OZlVPQmi1f8oi0mCdC0TnBKHztx5/oNBIx8Uk+dgAONEw7SnenhjrA8tXWyttVWVtV Wmi0DMRfEAkl9/fHWJEdTU7R2hMKNXzQYqNFhvIn2UF9bUuXSzxjWpcdggt0mKeBhzXU haqA== 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=10IJ0Mj1dAOiSmr5SVGnpMz3F06BvwzBRSWCtGVUKjI=; b=UZ6GSs1JF1ZD3iND6n07gP70Ja3Z1hREXemSt1iCvGoR5S6rJp/CiQN/kl1KIv8zQF dXvLB3fNdSBBzjYyM3Gzsjr8R1k+Sjvm4LS+3wjLvk+gdhH3llf63BmAEfg4gOIBlzTs 9QAMNo3K/ksW3Cx9dMSpq+z95Rk9HibYmQ/ED+WLYdl6LUJyA+aUOh6ayD2XM6cewEe3 NRGyO0s8Il34qMxx0FDMxTbdy6fSwCa2d3QTaAzwVhsWkebhlIfxk7fAtLAQevH5PKie p297RpS6SY5pD4oL9CZspbLi4kgyWAQXngqXQR1wvDKEdaq/l8LHcT6AEn5fXEGdj9+m cv9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IhXcVYLJ; 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 y135si12651986ywy.308.2018.11.20.04.21.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 20 Nov 2018 04:21:14 -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=IhXcVYLJ; 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]:33365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gP51l-0004pc-8k for patch@linaro.org; Tue, 20 Nov 2018 07:21:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gP4x9-0001mQ-9B for qemu-devel@nongnu.org; Tue, 20 Nov 2018 07:16:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gP4x8-00053m-5D for qemu-devel@nongnu.org; Tue, 20 Nov 2018 07:16:27 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:34891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gP4x7-00053X-Vk for qemu-devel@nongnu.org; Tue, 20 Nov 2018 07:16:26 -0500 Received: by mail-pl1-x642.google.com with SMTP id v1-v6so930592plo.2 for ; Tue, 20 Nov 2018 04:16:25 -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=10IJ0Mj1dAOiSmr5SVGnpMz3F06BvwzBRSWCtGVUKjI=; b=IhXcVYLJaanwxKFUe33KaX4oBzZBqdaPupfMiwU1EvTaUfZmM3WIlv0LoGyBC8N2rO OTJpAoGo8zymP4umSybv7gaLu69LN1ZedwLazKn3jlWYHgfZyyD27ZnciQswX8g3RM4v aiqPX8ktj2jS3F1+nu1vsnx9xkAMAu2TiAdDw= 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=10IJ0Mj1dAOiSmr5SVGnpMz3F06BvwzBRSWCtGVUKjI=; b=dboJg9mAmLDgNF0jGAW7NOpmL6bOrvOh+448yK1ZmS6/FB6mMfHGlbFptCP7pN9HmK 6KlgccyvYcSnJ+Tmkn+GcvsoFaCnFlLdjNu8VLsypbPpos4zDHqqMNkBjLEBPqeS8i6o 9SFrNMXWVK0jNF2uzgtgHfz6BkjB9YZLo/wYuRd0OGWTmS9n5Iu38tm05dOzPPqecaDh AEk2jaUELJ3hPtaZSaWgn1n0MPEnH3/ruXuBl/z26KcCzjpCgI2h21mk4K+qGHKB4GNL qeiyhRyv2j9nFsq6wVrvJw/Rz52U5AOwuHm7vW5Za6XxRaUXA2po1rh5yZWpJWfiFN46 n3jA== X-Gm-Message-State: AA+aEWYRTl/VCbJeK0XGBaWRHFWaGFb9exc09wF34ME6yc0ullNuEMFN mRlzoO6LK6/+MOTbrINPb1u5bduR9WK6rQ== X-Received: by 2002:a17:902:6502:: with SMTP id b2mr1984792plk.44.1542716184603; Tue, 20 Nov 2018 04:16:24 -0800 (PST) Received: from cloudburst.twiddle.net ([172.56.31.89]) by smtp.gmail.com with ESMTPSA id p11sm39244346pgn.60.2018.11.20.04.16.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Nov 2018 04:16:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 20 Nov 2018 13:15:57 +0100 Message-Id: <20181120121558.7660-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181120121558.7660-1-richard.henderson@linaro.org> References: <20181120121558.7660-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH 4/5] tcg/aarch64: Set TCG_TARGET_HAS_MEMORY_BSWAP to false 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 allows us to remove some code from the backend, allowing the generic code to emit any extra bswaps. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.h | 2 +- tcg/aarch64/tcg-target.inc.c | 63 ++++++++---------------------------- 2 files changed, 14 insertions(+), 51 deletions(-) -- 2.17.2 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index f966a4fcb3..ef9e9084b2 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -137,7 +137,7 @@ typedef enum { #define TCG_TARGET_HAS_mul_vec 1 #define TCG_TARGET_DEFAULT_MO (0) -#define TCG_TARGET_HAS_MEMORY_BSWAP 1 +#define TCG_TARGET_HAS_MEMORY_BSWAP 0 static inline void flush_icache_range(uintptr_t start, uintptr_t stop) { diff --git a/tcg/aarch64/tcg-target.inc.c b/tcg/aarch64/tcg-target.inc.c index 083592a4d7..784c31d783 100644 --- a/tcg/aarch64/tcg-target.inc.c +++ b/tcg/aarch64/tcg-target.inc.c @@ -1383,9 +1383,6 @@ static void * const qemu_ld_helpers[16] = { [MO_LEUW] = helper_le_lduw_mmu, [MO_LEUL] = helper_le_ldul_mmu, [MO_LEQ] = helper_le_ldq_mmu, - [MO_BEUW] = helper_be_lduw_mmu, - [MO_BEUL] = helper_be_ldul_mmu, - [MO_BEQ] = helper_be_ldq_mmu, }; /* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr, @@ -1397,9 +1394,6 @@ static void * const qemu_st_helpers[16] = { [MO_LEUW] = helper_le_stw_mmu, [MO_LEUL] = helper_le_stl_mmu, [MO_LEQ] = helper_le_stq_mmu, - [MO_BEUW] = helper_be_stw_mmu, - [MO_BEUL] = helper_be_stl_mmu, - [MO_BEQ] = helper_be_stq_mmu, }; static inline void tcg_out_adr(TCGContext *s, TCGReg rd, void *target) @@ -1421,7 +1415,7 @@ static void tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_mov(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, oi); tcg_out_adr(s, TCG_REG_X3, lb->raddr); - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call(s, qemu_ld_helpers[opc & MO_SIZE]); if (opc & MO_SIGN) { tcg_out_sxt(s, lb->type, size, lb->datalo_reg, TCG_REG_X0); } else { @@ -1444,7 +1438,7 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) tcg_out_mov(s, size == MO_64, TCG_REG_X2, lb->datalo_reg); tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X3, oi); tcg_out_adr(s, TCG_REG_X4, lb->raddr); - tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_call(s, qemu_st_helpers[opc & MO_SIZE]); tcg_out_goto(s, lb->raddr); } @@ -1544,8 +1538,6 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp memop, TCGType ext, TCGReg data_r, TCGReg addr_r, TCGType otype, TCGReg off_r) { - const TCGMemOp bswap = memop & MO_BSWAP; - switch (memop & MO_SSIZE) { case MO_UB: tcg_out_ldst_r(s, I3312_LDRB, data_r, addr_r, otype, off_r); @@ -1556,43 +1548,22 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp memop, TCGType ext, break; case MO_UW: tcg_out_ldst_r(s, I3312_LDRH, data_r, addr_r, otype, off_r); - if (bswap) { - tcg_out_rev16(s, data_r, data_r); - } break; case MO_SW: - if (bswap) { - tcg_out_ldst_r(s, I3312_LDRH, data_r, addr_r, otype, off_r); - tcg_out_rev16(s, data_r, data_r); - tcg_out_sxt(s, ext, MO_16, data_r, data_r); - } else { - tcg_out_ldst_r(s, (ext ? I3312_LDRSHX : I3312_LDRSHW), - data_r, addr_r, otype, off_r); - } + tcg_out_ldst_r(s, (ext ? I3312_LDRSHX : I3312_LDRSHW), + data_r, addr_r, otype, off_r); break; case MO_UL: tcg_out_ldst_r(s, I3312_LDRW, data_r, addr_r, otype, off_r); - if (bswap) { - tcg_out_rev32(s, data_r, data_r); - } break; case MO_SL: - if (bswap) { - tcg_out_ldst_r(s, I3312_LDRW, data_r, addr_r, otype, off_r); - tcg_out_rev32(s, data_r, data_r); - tcg_out_sxt(s, TCG_TYPE_I64, MO_32, data_r, data_r); - } else { - tcg_out_ldst_r(s, I3312_LDRSWX, data_r, addr_r, otype, off_r); - } + tcg_out_ldst_r(s, I3312_LDRSWX, data_r, addr_r, otype, off_r); break; case MO_Q: tcg_out_ldst_r(s, I3312_LDRX, data_r, addr_r, otype, off_r); - if (bswap) { - tcg_out_rev64(s, data_r, data_r); - } break; default: - tcg_abort(); + g_assert_not_reached(); } } @@ -1600,35 +1571,21 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGMemOp memop, TCGReg data_r, TCGReg addr_r, TCGType otype, TCGReg off_r) { - const TCGMemOp bswap = memop & MO_BSWAP; - switch (memop & MO_SIZE) { case MO_8: tcg_out_ldst_r(s, I3312_STRB, data_r, addr_r, otype, off_r); break; case MO_16: - if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev16(s, TCG_REG_TMP, data_r); - data_r = TCG_REG_TMP; - } tcg_out_ldst_r(s, I3312_STRH, data_r, addr_r, otype, off_r); break; case MO_32: - if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev32(s, TCG_REG_TMP, data_r); - data_r = TCG_REG_TMP; - } tcg_out_ldst_r(s, I3312_STRW, data_r, addr_r, otype, off_r); break; case MO_64: - if (bswap && data_r != TCG_REG_XZR) { - tcg_out_rev64(s, TCG_REG_TMP, data_r); - data_r = TCG_REG_TMP; - } tcg_out_ldst_r(s, I3312_STRX, data_r, addr_r, otype, off_r); break; default: - tcg_abort(); + g_assert_not_reached(); } } @@ -1637,6 +1594,9 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data_reg, TCGReg addr_reg, { TCGMemOp memop = get_memop(oi); const TCGType otype = TARGET_LONG_BITS == 64 ? TCG_TYPE_I64 : TCG_TYPE_I32; + + tcg_debug_assert(!(memop & MO_BSWAP)); + #ifdef CONFIG_SOFTMMU unsigned mem_index = get_mmuidx(oi); tcg_insn_unit *label_ptr; @@ -1662,6 +1622,9 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data_reg, TCGReg addr_reg, { TCGMemOp memop = get_memop(oi); const TCGType otype = TARGET_LONG_BITS == 64 ? TCG_TYPE_I64 : TCG_TYPE_I32; + + tcg_debug_assert(!(memop & MO_BSWAP)); + #ifdef CONFIG_SOFTMMU unsigned mem_index = get_mmuidx(oi); tcg_insn_unit *label_ptr;