From nobody Thu Oct 31 00:20:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623660990; cv=none; d=zohomail.com; s=zohoarc; b=Na942qzsDxJvU4osNwcqWawMhDDSWZfIBpNqtXJO5JJtiD/Y/tUSmMKpD/LZEehe5C70GZx+FxjQ5+665S+1/xz3fxZmcWSAEt4nB296BZ1QqFkRkOJqOomndI1dZAGqzJ2ZfGTNIu7c+NGQLJ2sZgCE3LJc48glZ/TZI0T+F6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623660990; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ujtnjSEKjc/8E8rHyRJKp/40jerX6TctpTGbnCUlGKA=; b=Q+32CKhj3B68eQxDWnwkppJWlBBRLFWz2qeUU7x8pfFL2MZ+X7cDXE+uTLcD2fXr8GUkHAVigQ5ZUjahtFftnN2s3SM0Vkef70ctVwZXDv3O2ecmr/Ag3O7kxtoy+p+bkKFlSoT6QqsrDESEnElv/C9XOgsEeo8RDu56fm4WQ+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623660990151464.1970370346871; Mon, 14 Jun 2021 01:56:30 -0700 (PDT) Received: from localhost ([::1]:34820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsiOT-0003iw-2h for importer@patchew.org; Mon, 14 Jun 2021 04:56:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsi73-0002nT-Kg for qemu-devel@nongnu.org; Mon, 14 Jun 2021 04:38:29 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:38632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsi6t-0003eG-ET for qemu-devel@nongnu.org; Mon, 14 Jun 2021 04:38:29 -0400 Received: by mail-pg1-x52e.google.com with SMTP id t17so8058927pga.5 for ; Mon, 14 Jun 2021 01:38:18 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id h20sm2242022pfh.24.2021.06.14.01.38.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 01:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ujtnjSEKjc/8E8rHyRJKp/40jerX6TctpTGbnCUlGKA=; b=zc3MQSgb8EYYdRAhQzvwdVFL82MWfYNvZglaUd/90IiGYKPqzJ4UMJeOvbGmWJE2aW v+K8CHFXJqmvYdOo7eLpIHhA+b/LmHKj2AsEp8UgvYtSRB54izdF6KIOQICijMZg2Fni CKxpQs8xi7trWHdXtp/hM6FajJ6W2eTc8dnW8y5lBAaLmvxPy+72ZdfIcpti4j9B5Big L2zjVzgkhuJKqTp2Q8oGNDqIrnGSdNJpbAF9gOwPDjmMBwodzAyzCEOtfgTGkVTRZdRX u8iXe2PXU77WzjkurZauyoSiZCzBPuTOjiTxoZ8ljNDJ/zCg7VEAhB/bVdFkjfD0TUdh yJSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ujtnjSEKjc/8E8rHyRJKp/40jerX6TctpTGbnCUlGKA=; b=kpmhAlH1e2BSYWqRq75A7e/MDf6qp/0kcVHO2QBn3qY0oTqHzcTjsIbwHsXKbSNVMo 5GbHG2E77wY1KeL0/HxGyzIgqRigNME6k+vbde9AIBE+MC+G0dweS20e9qzrrB6qJp94 HnoQMyGS3tBGm1PD+jLAt0mFNINFS5cRTGpYizKowb05ADEVfPXM9VMJFwUleJ2wqwhA yaJo0mp9v8aS90BNNe7C2OIeFgJyIEOYuFJcw2WlIk/mPTN40slW/oSi4dyHzADoUYLN no4Rf1/Hdmz3iviib/NS1E2lxAOYhYztNTzdXXV7PUKvKENP/FIe45U5/JTvBfJaA6a1 XDQQ== X-Gm-Message-State: AOAM5312KmFf1FeZ4m5b6splFtuttKPSY+S8wb7BBhHmoXUqEWe/fdHR pWTYpEFMV0EnuFqJjjjpCwUKxTtTcWF1Mw== X-Google-Smtp-Source: ABdhPJwaDStm07bdY5uuwRoB2rARU5wRq4YqW/iQhD5QORGDsSPta8m1KxhVqaMOU1OXWornpRKhSg== X-Received: by 2002:a65:63d2:: with SMTP id n18mr16011207pgv.447.1623659898145; Mon, 14 Jun 2021 01:38:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 28/28] tcg/riscv: Remove MO_BSWAP handling Date: Mon, 14 Jun 2021 01:38:00 -0700 Message-Id: <20210614083800.1166166-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614083800.1166166-1-richard.henderson@linaro.org> References: <20210614083800.1166166-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" TCG_TARGET_HAS_MEMORY_BSWAP is already unset for this backend, which means that MO_BSWAP be handled by the middle-end and will never be seen by the backend. Thus the indexes used with qemu_{ld,st}_helpers will always be zero. Tidy the comments and asserts in tcg_out_qemu_{ld,st}_direct. It is not that we do not handle bswap "yet", but never will. Signed-off-by: Richard Henderson Acked-by: Alistair Francis --- tcg/riscv/tcg-target.c.inc | 64 ++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index da7eecafc5..c16f96b401 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -852,37 +852,43 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * TCGMemOpIdx oi, uintptr_t ra) */ -static void * const qemu_ld_helpers[16] =3D { - [MO_UB] =3D helper_ret_ldub_mmu, - [MO_SB] =3D helper_ret_ldsb_mmu, - [MO_LEUW] =3D helper_le_lduw_mmu, - [MO_LESW] =3D helper_le_ldsw_mmu, - [MO_LEUL] =3D helper_le_ldul_mmu, +static void * const qemu_ld_helpers[8] =3D { + [MO_UB] =3D helper_ret_ldub_mmu, + [MO_SB] =3D helper_ret_ldsb_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_UW] =3D helper_be_lduw_mmu, + [MO_SW] =3D helper_be_ldsw_mmu, + [MO_UL] =3D helper_be_ldul_mmu, #if TCG_TARGET_REG_BITS =3D=3D 64 - [MO_LESL] =3D helper_le_ldsl_mmu, + [MO_SL] =3D helper_be_ldsl_mmu, #endif - [MO_LEQ] =3D helper_le_ldq_mmu, - [MO_BEUW] =3D helper_be_lduw_mmu, - [MO_BESW] =3D helper_be_ldsw_mmu, - [MO_BEUL] =3D helper_be_ldul_mmu, + [MO_Q] =3D helper_be_ldq_mmu, +#else + [MO_UW] =3D helper_le_lduw_mmu, + [MO_SW] =3D helper_le_ldsw_mmu, + [MO_UL] =3D helper_le_ldul_mmu, #if TCG_TARGET_REG_BITS =3D=3D 64 - [MO_BESL] =3D helper_be_ldsl_mmu, + [MO_SL] =3D helper_le_ldsl_mmu, +#endif + [MO_Q] =3D helper_le_ldq_mmu, #endif - [MO_BEQ] =3D helper_be_ldq_mmu, }; =20 /* helper signature: helper_ret_st_mmu(CPUState *env, target_ulong addr, * uintxx_t val, TCGMemOpIdx oi, * uintptr_t ra) */ -static void * const qemu_st_helpers[16] =3D { - [MO_UB] =3D helper_ret_stb_mmu, - [MO_LEUW] =3D helper_le_stw_mmu, - [MO_LEUL] =3D helper_le_stl_mmu, - [MO_LEQ] =3D helper_le_stq_mmu, - [MO_BEUW] =3D helper_be_stw_mmu, - [MO_BEUL] =3D helper_be_stl_mmu, - [MO_BEQ] =3D helper_be_stq_mmu, +static void * const qemu_st_helpers[4] =3D { + [MO_8] =3D helper_ret_stb_mmu, +#ifdef HOST_WORDS_BIGENDIAN + [MO_16] =3D helper_be_stw_mmu, + [MO_32] =3D helper_be_stl_mmu, + [MO_64] =3D helper_be_stq_mmu, +#else + [MO_16] =3D helper_le_stw_mmu, + [MO_32] =3D helper_le_stl_mmu, + [MO_64] =3D helper_le_stq_mmu, +#endif }; =20 /* We don't support oversize guests */ @@ -997,7 +1003,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, T= CGLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, a2, oi); tcg_out_movi(s, TCG_TYPE_PTR, a3, (tcg_target_long)l->raddr); =20 - tcg_out_call(s, qemu_ld_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + tcg_out_call(s, qemu_ld_helpers[opc & MO_SSIZE]); tcg_out_mov(s, (opc & MO_SIZE) =3D=3D MO_64, l->datalo_reg, a0); =20 tcg_out_goto(s, l->raddr); @@ -1042,7 +1048,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, = TCGLabelQemuLdst *l) tcg_out_movi(s, TCG_TYPE_PTR, a3, oi); tcg_out_movi(s, TCG_TYPE_PTR, a4, (tcg_target_long)l->raddr); =20 - tcg_out_call(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SSIZE)]); + tcg_out_call(s, qemu_st_helpers[opc & MO_SIZE]); =20 tcg_out_goto(s, l->raddr); return true; @@ -1052,10 +1058,8 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s,= TCGLabelQemuLdst *l) static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, TCGReg base, MemOp opc, bool is_64) { - const MemOp bswap =3D opc & MO_BSWAP; - - /* We don't yet handle byteswapping, assert */ - g_assert(!bswap); + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) =3D=3D 0); =20 switch (opc & (MO_SSIZE)) { case MO_UB: @@ -1139,10 +1143,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCG= Arg *args, bool is_64) static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, TCGReg base, MemOp opc) { - const MemOp bswap =3D opc & MO_BSWAP; - - /* We don't yet handle byteswapping, assert */ - g_assert(!bswap); + /* Byte swapping is left to middle-end expansion. */ + tcg_debug_assert((opc & MO_BSWAP) =3D=3D 0); =20 switch (opc & (MO_SSIZE)) { case MO_8: --=20 2.25.1