From patchwork Thu Sep 8 22:32:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Rolnik X-Patchwork-Id: 9322289 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 CB9A4607D3 for ; Thu, 8 Sep 2016 23:07:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC7FB29909 for ; Thu, 8 Sep 2016 23:07:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D8A529A37; Thu, 8 Sep 2016 23:07:37 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_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 437E529909 for ; Thu, 8 Sep 2016 23:07:37 +0000 (UTC) Received: from localhost ([::1]:54602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi8Pw-0008Hp-F2 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Sep 2016 19:07:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi7sh-0003YM-7o for qemu-devel@nongnu.org; Thu, 08 Sep 2016 18:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi7se-0000pq-2C for qemu-devel@nongnu.org; Thu, 08 Sep 2016 18:33:15 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi7sd-0000pg-S5 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 18:33:11 -0400 Received: by mail-wm0-x242.google.com with SMTP id w12so203970wmf.1 for ; Thu, 08 Sep 2016 15:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jKuq53Ut8mnVUSnrFoDeKgwNOdCp61uFVLeVH5u48Rg=; b=OVPI9KpiHCYXF0Fy/fejjOvCoGH4/znusUGx4WVOoFagx7NY0qI5uOme7HLo9yLxt4 BCmca1Sgpcl6te6qJAiyuq8bi1xlkfhK9HoVNPbgpaG1qrsdrKuOathdif2FavtI1qjj dikEupWnknpUQ3dXC1LsyAtmF2h0LiNCeJu55GaZyqyPGHeZ/hiSihN1JwnvU/0/5D2P 8KIgBxgLTu6b99FGbLOhojoYqzBjJVjlyADDfacrRNgm+qXh2L8qr9E+so65/5eU8Qnt S+KV2FITeTD3xr5eFwJOYoKpfE0YqUTIR0Tv5V+q/g81qF6SzoWIFU4ujpMA9cAZYoSV JAhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jKuq53Ut8mnVUSnrFoDeKgwNOdCp61uFVLeVH5u48Rg=; b=nMsLzgEYuRk+M1kBP1J0M0zOxLrk0O4TorWCMUPXFVYOaM3j/N7ZtZXcABg9N4gmNb 0xRBdH8wid4jnUiX6zs+wtnKShLAjwSiX0VjSj2pO9EYsvrPo32msma87EcfWpBTyGuy +0HaU0XbFwjpjgBZj7nZJVyj2IkU/MqmlQO1v8MQlselAWIYjMNaRFjRletgQW9NPkxx 8QJAQ5ctVRE0RHYwspWFcmTTQ5yP08I8F+xIBVNVbx/+8ut72i27+jMLGWguyoRjnJFD gaXw0/GBQL+hVLkpUpsfqIJn54HTdWOkkwE8WxZzBxsI2qbUREmT/cVrU6ARGaSnjzcN n7hA== X-Gm-Message-State: AE9vXwPnaBMni7WoHLmDocsAopHW0DyapXAcfjBlUjw2etRqa+tlVF94A96SVvv3j/JC+g== X-Received: by 10.28.212.211 with SMTP id l202mr591827wmg.109.1473373991092; Thu, 08 Sep 2016 15:33:11 -0700 (PDT) Received: from a0999b0126e1.ant.amazon.com ([94.230.86.12]) by smtp.gmail.com with ESMTPSA id d8sm276298wmi.0.2016.09.08.15.33.09 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Sep 2016 15:33:10 -0700 (PDT) From: Michael Rolnik To: qemu-devel@nongnu.org Date: Fri, 9 Sep 2016 01:32:08 +0300 Message-Id: <1473373930-31547-28-git-send-email-mrolnik@gmail.com> X-Mailer: git-send-email 2.4.9 (Apple Git-60) In-Reply-To: <1473373930-31547-1-git-send-email-mrolnik@gmail.com> References: <1473373930-31547-1-git-send-email-mrolnik@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH RFC v1 27/29] target-arc: LP 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: Michael Rolnik Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Michael Rolnik --- target-arc/helper.h | 1 + target-arc/op_helper.c | 5 ++++- target-arc/translate-inst.c | 40 ++++++++++++++++++++++++++++++++++++++++ target-arc/translate-inst.h | 2 ++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/target-arc/helper.h b/target-arc/helper.h index abfd0d2..ef5c12e 100644 --- a/target-arc/helper.h +++ b/target-arc/helper.h @@ -25,4 +25,5 @@ DEF_HELPER_2(lr, tl, env, i32) DEF_HELPER_2(sr, void, i32, i32) DEF_HELPER_1(halt, void, env) DEF_HELPER_1(rtie, void, env) +DEF_HELPER_1(flush, void, env) diff --git a/target-arc/op_helper.c b/target-arc/op_helper.c index a3f6a46..61e790e 100644 --- a/target-arc/op_helper.c +++ b/target-arc/op_helper.c @@ -437,4 +437,7 @@ void helper_rtie(CPUARCState *env) } } - +void helper_flush(CPUARCState *env) +{ + tb_flush((CPUState *)arc_env_get_cpu(env)); +} diff --git a/target-arc/translate-inst.c b/target-arc/translate-inst.c index 743f2be..87940ed 100644 --- a/target-arc/translate-inst.c +++ b/target-arc/translate-inst.c @@ -2813,3 +2813,43 @@ int arc_gen_RTIE(DisasCtxt *ctx) return BS_BRANCH; } +/* + LPcc +*/ +int arc_gen_LPcc(DisasCtxt *ctx, TCGv rd, unsigned Q) +{ + TCGLabel *label_done = gen_new_label(); + TCGv t0 = tcg_const_local_i32(ctx->npc); + + /* + if cc is false, pc will be updated here + pc = pcl + rd + */ + tcg_gen_shli_tl(cpu_pc, rd, 1); + tcg_gen_addi_tl(cpu_pc, cpu_pc, ctx->pcl); + + /* + if cc is false we will jump to done label + */ + arc_gen_jump_ifnot(ctx, Q, label_done); + + /* + cc is true + */ + tcg_gen_movi_tl(t0, ctx->lpe); + + tcg_gen_movi_tl(cpu_lps, ctx->npc); + tcg_gen_mov_tl(cpu_lpe, cpu_pc); + tcg_gen_movi_tl(cpu_pc, ctx->npc); + + tcg_gen_brcond_tl(TCG_COND_EQ, t0, cpu_lpe, label_done); + + gen_helper_flush(cpu_env); + +gen_set_label(label_done); + + tcg_temp_free_i32(t0); + + return BS_BRANCH; +} + diff --git a/target-arc/translate-inst.h b/target-arc/translate-inst.h index 8bbac4f..7ea20a0 100644 --- a/target-arc/translate-inst.h +++ b/target-arc/translate-inst.h @@ -171,3 +171,5 @@ int arc_gen_TRAP(DisasCtxt *c, TCGv src1); int arc_gen_RTIE(DisasCtxt *c); +int arc_gen_LPcc(DisasCtxt *ctx, TCGv Rd, unsigned Q); +