From patchwork Sat Nov 4 03:45:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10041441 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 D1D836032A for ; Sat, 4 Nov 2017 04:00:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C06BF296AD for ; Sat, 4 Nov 2017 04:00:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B552929A11; Sat, 4 Nov 2017 04:00:42 +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, HK_RANDOM_FROM, 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 60FF7296AD for ; Sat, 4 Nov 2017 04:00:42 +0000 (UTC) Received: from localhost ([::1]:39260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eApdR-0008RG-M4 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 04 Nov 2017 00:00:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eApPk-0006IU-4m for qemu-devel@nongnu.org; Fri, 03 Nov 2017 23:46:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eApPj-00017V-A2 for qemu-devel@nongnu.org; Fri, 03 Nov 2017 23:46:32 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:52161) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eApPj-000161-2k for qemu-devel@nongnu.org; Fri, 03 Nov 2017 23:46:31 -0400 Received: by mail-lf0-x243.google.com with SMTP id r129so5155440lff.8 for ; Fri, 03 Nov 2017 20:46:30 -0700 (PDT) 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=xArUMLMVBmBG4DhC3ew+klSDo9vWzSN33c/TClz/H40=; b=IDvd5dhRLJd5hGeK85srVW9aNzPhq4B+ftd/HzaoaLztY7MwBYJ4E27nqWujjGZIOi BTz/wiHDEqqAaNMw6oDskF24UUvuuotBLY5tJkrLFoH3uyncyP6tvz/FDCzknZuJh3Qq RritXL8SZOkdrPlp/ATWRGQo0wKKG74bjrMDjXUJjkG9xTBc5EZj4MxS7CKZ0GnV+JP6 aV4VVzyRkEZ+ZKFdQeBp4wJihu3k19mM7JjNi70GsZaS18EcYbsoNuiil0sk4DSur4dp y2GZ/9k9jeshItr69qK8fGL1oQ0OxW2wIaoqrTDTSB7VaiGHFtaTxEx4w0VaKLF2Adsb BOWA== 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=xArUMLMVBmBG4DhC3ew+klSDo9vWzSN33c/TClz/H40=; b=pm9NlpNoUh9bgU66uNdzI7zpyv2FxIcqCxw3cHOSiTkhCl7zMNsufiQmR4MZsurowu S+uX2T4UbYSFP2vXEcmVnoQgAYEbxDS2/au80MR1i9yDfRRMCU0nviHVYe904bBW5TZt vyU3kdxUl0L+cYbrYukDgVIkbFj5c+0yQI3dje3G0Nv2NnymBb+VHdj3v/Xbf0Or6az0 f7evEXN8xWk+Rm0/aJ4Ch8jLiYJp8NUviuGON+5Oi7bsKmIKQdAsDz92qAiG0rnYQieF XyyXE/8PnCX8LtaDXJJRwo9dg0Uuoro7q373dVB6gWF6gi6AkvJPqAwUmUuxWLp+2YPs gveQ== X-Gm-Message-State: AMCzsaWlUiHQKjyo4KMUWAmbtZaSQvo1MVYVfpJ5FBcFZ8pG7iH/swp1 wHDTxTfqeSqIWQ/BS6ThpSYdwg== X-Google-Smtp-Source: ABhQp+SwFyJj7Y+0on4Pd8bEUAySCwOGCnGCJgMifSByAFop6utzzrBK+wt3ECLbalWtEA4sAAZQfQ== X-Received: by 10.46.83.67 with SMTP id t3mr3710861ljd.135.1509767189686; Fri, 03 Nov 2017 20:46:29 -0700 (PDT) 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 h3sm1258383lfj.26.2017.11.03.20.46.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 20:46:29 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Fri, 3 Nov 2017 20:45:20 -0700 Message-Id: <1509767121-26925-16-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1509767121-26925-1-git-send-email-jcmvbkbc@gmail.com> References: <1509767121-26925-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:4010:c07::243 Subject: [Qemu-devel] [PATCH 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 --- target/xtensa/translate.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index a84bbf3bedc3..f249e810d92c 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 v = tcg_temp_new_i32(); + + tcg_gen_shli_i32(v, cpu_R[arg[0]], 16); + tcg_gen_ori_i32(cpu_R[arg[0]], v, arg[1] & 0xffff); + } +} + /* 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, }, {