From patchwork Wed Feb 17 20:19:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 383858 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3114728jao; Wed, 17 Feb 2021 12:31:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzskBkDR6ycC+nAX8D1yVpf5WmJOZAdgBAfmN4DV24xJfgfHnFMd2C8f1yF6xc1W4MR/uox X-Received: by 2002:a25:68cf:: with SMTP id d198mr1793651ybc.258.1613593887097; Wed, 17 Feb 2021 12:31:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613593887; cv=none; d=google.com; s=arc-20160816; b=H1dLo49EGhQZCPhMAJXXZM+3LOX2WRTSDb66Z7Ll5R+0XkwcrX+DR8AXeh1tF1ZFk5 xDa2iFJPmoi2ZTE2mqcqTZmk2wG24cnvtC0mNY15UbUSsw0rwumrojJh686//K8QcPGN jXcOP7MtJgXd1YK0hqRtkf1QVTAFwIEKRQXIATQFaPodKeuYCFZSXeErUaT6g/6MmNU5 6JijNlSHt41WNMeehbbJRwlWKmJD9Qapl3Wio82WD0guGSdsS+j1DisSFc7wBoXxpLuD pdROTE9pqD/R+X1S/644NN6PH8bhPO0t10ET8EOlYTVlk+AmxHJ6ageYMigUPI8OavIN zp/Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=EgfsM+xDw/5+yMWEqnFKIWyZYHRInwuGtrXJDDW2BOY=; b=m6R8o4dmcDH8/BR3A4AjaSf6KFlKC6Ib6bvvHBag7YUxhXeQqCgXYZ1apKkOhGOGif tvwHIlQwBNRjIwQVUDIFxcJsrd0q3bV/qcQvG62/ZlkuaEe2a1cRYbQiMgofgiFtUbt/ Mo4PcaFF1aY0m0nr7ZerX2d0Afw87iSZyogMB48BinebDBlO6T/kRh418T1r0kHveF5v j4coZK/h9qMf60yXEl50u9jLO91B57eAkfyWppJVbAcfaHu49DgTGL8RWqDPYhPVty0o 0KROLlljd+O7o/Stf73kPLXl+tBKXwhl0h60RALAb04+zlNb4YhAsas2wpDnJxZNZl2w vqIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bp59r9W5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id r16si3311949ybk.339.2021.02.17.12.31.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Feb 2021 12:31:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bp59r9W5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:40002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCTTh-0007rE-Qb for patch@linaro.org; Wed, 17 Feb 2021 15:31:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCTKj-0006vX-0y for qemu-devel@nongnu.org; Wed, 17 Feb 2021 15:22:01 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:36641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCTKg-00076n-Qp for qemu-devel@nongnu.org; Wed, 17 Feb 2021 15:22:00 -0500 Received: by mail-pl1-x631.google.com with SMTP id e9so8041724plh.3 for ; Wed, 17 Feb 2021 12:21:58 -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 :mime-version:content-transfer-encoding; bh=EgfsM+xDw/5+yMWEqnFKIWyZYHRInwuGtrXJDDW2BOY=; b=bp59r9W52AqrOpQmmWqIIz2nu1XMR7KvXlp91r09l/gU3hlTAWA1xE8mGel3Vk0+JX bDey9MsJYU8GpqufIkdypXxzLxKNnCpAARQHmR+QhehuqCEMpfCmIXn0qakSUK/VlKeQ Qyhc3+oG0IAFzLG1UQt2Ifu0S34d+oWUasRs9/cC/ZUNd54wjiFFEUym/fHC+5o2DLqc vqHTvX8hmf6Fm4QsiukwAPpFvxNDF2blO2smwjcHmhSB9wPHdK+RsidtKSkAH0wgyl0F BcQXDNRnxHTnLu2w4lq20vaa0kBXqn2zI2tMb2+spBVRg3IQJAxos86fq8PDDxQugwNj 9i6A== 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:mime-version:content-transfer-encoding; bh=EgfsM+xDw/5+yMWEqnFKIWyZYHRInwuGtrXJDDW2BOY=; b=GvFsapBe84ih1ILfiHw+a+BQPx9o7GpbThbe2iFMabXlmTHHBuw9y8XHKCMC5CssDf V10PG0hBB5cbNd3dJxKeWoSF8J9PsaGo1LJ8JKK2TltAGmPiRE+Wya4gjwj7K07OdWuY +jehRHeNFLeFDV+ExmejL95egBUYJUgValZ8q6JD8oWDaxn04SDZzKtI9YOnFXU0W3wG gfySciaHq3REM57g8qOtMn88ziA3EaBYj5z88ldQCVete+lE8Pr27ChxdYWIjdW+GoCu vwLIhHCpF93nCpmqQZn2PoaSbRVmBCR42aDswpYYIEUVuDuGNEq+PEo3dTutK8iGZdAh F+xA== X-Gm-Message-State: AOAM532E+nWpXxAvM/4s5bmJYrjDAxn9iTTOJqaeQpDI8JIeeseG52Nz j0fQ7jlTw3pzbuGxJXLICkKxIsY0K52NAA== X-Received: by 2002:a17:902:9a48:b029:e1:268d:e800 with SMTP id x8-20020a1709029a48b02900e1268de800mr905692plv.69.1613593317614; Wed, 17 Feb 2021 12:21:57 -0800 (PST) Received: from localhost.localdomain (047-051-160-125.biz.spectrum.com. [47.51.160.125]) by smtp.gmail.com with ESMTPSA id 3sm3001576pjk.26.2021.02.17.12.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 12:21:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 07/71] tcg/tci: Remove tci_read_r16 Date: Wed, 17 Feb 2021 12:19:32 -0800 Message-Id: <20210217202036.1724901-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202036.1724901-1-richard.henderson@linaro.org> References: <20210217202036.1724901-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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: , Cc: sw@weilnetz.de, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use explicit casts for ext16u opcodes, and allow truncation to happen with the store for st16 opcodes, and with the call for bswap16 opcodes. Signed-off-by: Richard Henderson --- tcg/tci.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/tci.c b/tcg/tci.c index 7325c8bfd0..2440da1746 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -71,11 +71,6 @@ static int32_t tci_read_reg32s(const tcg_target_ulong *regs, TCGReg index) } #endif -static uint16_t tci_read_reg16(const tcg_target_ulong *regs, TCGReg index) -{ - return (uint16_t)tci_read_reg(regs, index); -} - static uint32_t tci_read_reg32(const tcg_target_ulong *regs, TCGReg index) { return (uint32_t)tci_read_reg(regs, index); @@ -157,15 +152,6 @@ tci_read_r(const tcg_target_ulong *regs, const uint8_t **tb_ptr) return value; } -/* Read indexed register (16 bit) from bytecode. */ -static uint16_t tci_read_r16(const tcg_target_ulong *regs, - const uint8_t **tb_ptr) -{ - uint16_t value = tci_read_reg16(regs, **tb_ptr); - *tb_ptr += 1; - return value; -} - #if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 /* Read indexed register (16 bit signed) from bytecode. */ static int16_t tci_read_r16s(const tcg_target_ulong *regs, @@ -509,7 +495,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, *(uint8_t *)(t1 + t2) = t0; break; CASE_32_64(st16) - t0 = tci_read_r16(regs, &tb_ptr); + t0 = tci_read_r(regs, &tb_ptr); t1 = tci_read_r(regs, &tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; @@ -699,14 +685,14 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, #if TCG_TARGET_HAS_ext16u_i32 case INDEX_op_ext16u_i32: t0 = *tb_ptr++; - t1 = tci_read_r16(regs, &tb_ptr); - tci_write_reg(regs, t0, t1); + t1 = tci_read_r(regs, &tb_ptr); + tci_write_reg(regs, t0, (uint16_t)t1); break; #endif #if TCG_TARGET_HAS_bswap16_i32 case INDEX_op_bswap16_i32: t0 = *tb_ptr++; - t1 = tci_read_r16(regs, &tb_ptr); + t1 = tci_read_r(regs, &tb_ptr); tci_write_reg(regs, t0, bswap16(t1)); break; #endif @@ -907,8 +893,8 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, #if TCG_TARGET_HAS_ext16u_i64 case INDEX_op_ext16u_i64: t0 = *tb_ptr++; - t1 = tci_read_r16(regs, &tb_ptr); - tci_write_reg(regs, t0, t1); + t1 = tci_read_r(regs, &tb_ptr); + tci_write_reg(regs, t0, (uint16_t)t1); break; #endif #if TCG_TARGET_HAS_ext32s_i64 @@ -930,7 +916,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, #if TCG_TARGET_HAS_bswap16_i64 case INDEX_op_bswap16_i64: t0 = *tb_ptr++; - t1 = tci_read_r16(regs, &tb_ptr); + t1 = tci_read_r(regs, &tb_ptr); tci_write_reg(regs, t0, bswap16(t1)); break; #endif