From patchwork Tue Dec 19 05:38:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10122523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8F8DC603B5 for ; Tue, 19 Dec 2017 05:52:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 800A128D01 for ; Tue, 19 Dec 2017 05:52:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 736112905A; Tue, 19 Dec 2017 05:52:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2B70828D01 for ; Tue, 19 Dec 2017 05:52:57 +0000 (UTC) Received: from localhost ([::1]:50904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRApk-0003jX-EG for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Dec 2017 00:52:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRAdN-0001Ds-8o for qemu-devel@nongnu.org; Tue, 19 Dec 2017 00:40:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRAdM-00026Z-EO for qemu-devel@nongnu.org; Tue, 19 Dec 2017 00:40:09 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33494) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRAdM-00025t-6x for qemu-devel@nongnu.org; Tue, 19 Dec 2017 00:40:08 -0500 Received: by mail-wr0-x244.google.com with SMTP id v21so6297372wrc.0 for ; Mon, 18 Dec 2017 21:40:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9YsrE4E83EIjB0XvnDN2m2IQ1nOi77zyBQ9sRmmYDzs=; b=gV5+Xt9gL9BcWMzdE/6nJICXr38OSIvFxIE7zKXHGIXYI61QSuOipkg3cLW0vqi9A8 SlglLqaD6LaLRfa58E82l+LbCe0M4gUx9Y8dxLS7BCONutn/9WGqThqJiO5q8L0AzQ+B hH9Uo9zbP/2sS6bAAz9FPRZMwZsb7kQyZfBTBss24cZG5Edm9ZaNmXlvCmUeRfXlrUE3 Ah+hg8GihVxnh3tQER7NdkFoq/C4tRAHv95eyxmGFGzdwGwhavet42fY8/Re1toC2Evc BTAwQNcUwvTo4j66Ab6Yd5zwzpjXUX+stthfK2A6E9ROk658CLKvEcGtTXw/hgtXrvAg Qm+A== 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=9YsrE4E83EIjB0XvnDN2m2IQ1nOi77zyBQ9sRmmYDzs=; b=rVmfJceLzlqAKINVv1GqM1+BOA/QglVCMz4YdCHiZrOtudGSgkMio6zv4pM9CsOGHz F3GtXCBMNpSWIv//s8WpD2FJUhvzJkYKAjqyMiTx6nRGIYLStLhUdR4vXpiIBKofhEmJ U/2USBVkP6FTi6r3MvWU0ZsQwPP+i0t1RElPBJq5LRN7To1NuKhkhJAyajZCUMjxm61Q AlnVcPD0rNfyFVysg+LiqhaObBZmDWVZgWsw9/hz9pv4o46j0qM9VWfBnr4EwZCiWZVg ZirE8c+4TuLB6iBOvOcEH2bNVh7LipMwGPytU85v5BxSQfSABNmup5rOrMeHrRgoepTo A+eA== X-Gm-Message-State: AKGB3mIoQEUIjBYToLiXEsSUVa9e4fnz2CjymZniMqPQJmSSgSDf4TYe owIRxTbuMblKCqasUUHp2C15+g== X-Google-Smtp-Source: ACJfBovqsMDEuLJRq4abOaMUi6s8R7T+UNV43nlCUZ0gt1CwsJvOmDkWnyZLTAOXFiJ1RRkxWYgHFQ== X-Received: by 10.46.21.79 with SMTP id 15mr1260452ljv.27.1513662007047; Mon, 18 Dec 2017 21:40:07 -0800 (PST) Received: from octofox.net (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id f67sm673187lfb.83.2017.12.18.21.40.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Dec 2017 21:40:06 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 21:38:51 -0800 Message-Id: <1513661932-6849-16-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1513661932-6849-1-git-send-email-jcmvbkbc@gmail.com> References: <1513661932-6849-1-git-send-email-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v2 15/16] target/xtensa: implement const16 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: Max Filippov , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP const16 is an opcode that shifts 16 lower bits of an address register to the 16 upper bits and puts its immediate operand into the lower 16 bits. It is not controlled by an Xtensa option and doesn't have a fixed opcode. Signed-off-by: Max Filippov --- Changes v1->v2: - reimplement translate_const16 using tcg_gen_deposit_i32. target/xtensa/translate.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index a84bbf3bedc3..bf299dbf9a04 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1526,6 +1526,17 @@ static void translate_clrb_expstate(DisasContext *dc, const uint32_t arg[], tcg_gen_andi_i32(cpu_UR[EXPSTATE], cpu_UR[EXPSTATE], ~(1u << arg[0])); } +static void translate_const16(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + if (gen_window_check1(dc, arg[0])) { + TCGv_i32 c = tcg_const_i32(arg[1]); + + tcg_gen_deposit_i32(cpu_R[arg[0]], c, cpu_R[arg[0]], 16, 16); + tcg_temp_free(c); + } +} + /* par[0]: privileged, par[1]: check memory access */ static void translate_dcache(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) @@ -2742,6 +2753,9 @@ static const XtensaOpcodeOps core_ops[] = { .name = "clrb_expstate", .translate = translate_clrb_expstate, }, { + .name = "const16", + .translate = translate_const16, + }, { .name = "depbits", .translate = translate_depbits, }, {