From patchwork Wed Feb 13 15:53:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10810293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC6DB17E0 for ; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA84E2DEAF for ; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8AA92DEEB; Wed, 13 Feb 2019 16:12:58 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5326B2DEDF for ; Wed, 13 Feb 2019 16:12:58 +0000 (UTC) Received: from localhost ([127.0.0.1]:59327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtx9d-0005rC-EG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 13 Feb 2019 11:12:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtwtP-000205-Vw for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:56:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtwtM-0002xU-CP for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:56:11 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:37817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtwtM-0000ue-1H for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:56:08 -0500 Received: by mail-pg1-x52f.google.com with SMTP id q206so1317266pgq.4 for ; Wed, 13 Feb 2019 07:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=LXBF32AaANmz5XWbuwT7of+5Guxbigkz/EGiNqeSByw=; b=GJU6XaH8H1Mk/vW8AsDBinleM6Uz7OXkNGWQUCV1V8x8GftOnfU9vG+frvKHh2qGQS t9rXdYiOFzplSRrLsp5ZAWXmbe2j4bHnlf8AKD1eXiu0SKR/rcRvEtq/Y/tyG1tVM0Rg GZc5tJ+Xt5zD2hFMN6opxyzf2LuxLy8jl0JE9fuE+O9VekoyyockG1TpAU8iP5/1bgDX vw0GaTD7JAm6GdySPOxZu083Z3AePpxySTIgpl1GDmWwFg7e5mYIZGbGc9lnxyEVQzli 5TkVhXzNJuzNlINgfiogWitWlWxH2Ti3zvryr8+hA0CpsoZfpwWapn3crpB+K4bPLVqS UUaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=LXBF32AaANmz5XWbuwT7of+5Guxbigkz/EGiNqeSByw=; b=gy8xdwBaK3L3ipKHFQa/JHAMAhvl29ZTjd/F5B1fRP+gGjktNrMLNUNjd1aS0sxdvB El1MQLqPBvGvSEL142kX30tijYb3LFOxnehuBCmTDJ2jaKHY69zEdLBLh2WBC3bxVu2l NTx0z5V+JVMKlm822KCDVxno1uUf53Qt8sdazzSxX2z2AfNz/e+oL0ah7t1qC1j6RqIj 0yTG3KbO3oQSYOr75IHhY+DCzJ5wPuriU9jSYY2lq78ey/ynng8HVjo7f7Pzisqkejwo eZbAq9bJamvvCduX9hKEnkAqwnBd5HVka5yScXu0WUkk0aCSPsKhMC+d4c46k6SzTeU7 WWCw== X-Gm-Message-State: AHQUAuYE2e9cKPk/kmPlVEmevh9XvblyMQIkGByBv85it4NgS728etPU ZgvOBqK6wtNC5Kru07X41J686PLQgOg= X-Google-Smtp-Source: AHgI3IaT0sk+NJQBO6jnLV8vXtnZiyuwRJwiELHnGC0HLDzcrr5gPXumiVs3eDBhAYY8Vzc8qFx1hw== X-Received: by 2002:a62:5287:: with SMTP id g129mr1193683pfb.22.1550073283360; Wed, 13 Feb 2019 07:54:43 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id e21sm80141252pfh.45.2019.02.13.07.54.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 07:54:42 -0800 (PST) Date: Wed, 13 Feb 2019 07:53:43 -0800 Message-Id: <20190213155414.22285-5-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20190213155414.22285-1-palmer@sifive.com> References: <20190213155414.22285-1-palmer@sifive.com> From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52f Subject: [Qemu-devel] [PATCH v7 04/35] target/riscv: Convert RV32I load/store insns to decodetree 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: Bastian Koppelmann , Peer Adelt , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Bastian Koppelmann Acked-by: Alistair Francis Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 10 ++++++ target/riscv/insn_trans/trans_rvi.inc.c | 48 +++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index 81f56c16b45f..076de873c4f1 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -23,6 +23,7 @@ # immediates: %imm_i 20:s12 +%imm_s 25:s7 7:5 %imm_b 31:s1 7:1 25:6 8:4 !function=ex_shift_1 %imm_j 31:s1 12:8 20:1 21:10 !function=ex_shift_1 %imm_u 12:s20 !function=ex_shift_12 @@ -33,6 +34,7 @@ # Formats 32: @i ............ ..... ... ..... ....... imm=%imm_i %rs1 %rd @b ....... ..... ..... ... ..... ....... &b imm=%imm_b %rs2 %rs1 +@s ....... ..... ..... ... ..... ....... imm=%imm_s %rs2 %rs1 @u .................... ..... ....... imm=%imm_u %rd @j .................... ..... ....... imm=%imm_j %rd @@ -47,3 +49,11 @@ blt ....... ..... ..... 100 ..... 1100011 @b bge ....... ..... ..... 101 ..... 1100011 @b bltu ....... ..... ..... 110 ..... 1100011 @b bgeu ....... ..... ..... 111 ..... 1100011 @b +lb ............ ..... 000 ..... 0000011 @i +lh ............ ..... 001 ..... 0000011 @i +lw ............ ..... 010 ..... 0000011 @i +lbu ............ ..... 100 ..... 0000011 @i +lhu ............ ..... 101 ..... 0000011 @i +sb ....... ..... ..... 000 ..... 0100011 @s +sh ....... ..... ..... 001 ..... 0100011 @s +sw ....... ..... ..... 010 ..... 0100011 @s diff --git a/target/riscv/insn_trans/trans_rvi.inc.c b/target/riscv/insn_trans/trans_rvi.inc.c index bcf20def50eb..d13b7b2b6d8f 100644 --- a/target/riscv/insn_trans/trans_rvi.inc.c +++ b/target/riscv/insn_trans/trans_rvi.inc.c @@ -82,3 +82,51 @@ static bool trans_bgeu(DisasContext *ctx, arg_bgeu *a) gen_branch(ctx, OPC_RISC_BGEU, a->rs1, a->rs2, a->imm); return true; } + +static bool trans_lb(DisasContext *ctx, arg_lb *a) +{ + gen_load(ctx, OPC_RISC_LB, a->rd, a->rs1, a->imm); + return true; +} + +static bool trans_lh(DisasContext *ctx, arg_lh *a) +{ + gen_load(ctx, OPC_RISC_LH, a->rd, a->rs1, a->imm); + return true; +} + +static bool trans_lw(DisasContext *ctx, arg_lw *a) +{ + gen_load(ctx, OPC_RISC_LW, a->rd, a->rs1, a->imm); + return true; +} + +static bool trans_lbu(DisasContext *ctx, arg_lbu *a) +{ + gen_load(ctx, OPC_RISC_LBU, a->rd, a->rs1, a->imm); + return true; +} + +static bool trans_lhu(DisasContext *ctx, arg_lhu *a) +{ + gen_load(ctx, OPC_RISC_LHU, a->rd, a->rs1, a->imm); + return true; +} + +static bool trans_sb(DisasContext *ctx, arg_sb *a) +{ + gen_store(ctx, OPC_RISC_SB, a->rs1, a->rs2, a->imm); + return true; +} + +static bool trans_sh(DisasContext *ctx, arg_sh *a) +{ + gen_store(ctx, OPC_RISC_SH, a->rs1, a->rs2, a->imm); + return true; +} + +static bool trans_sw(DisasContext *ctx, arg_sw *a) +{ + gen_store(ctx, OPC_RISC_SW, a->rs1, a->rs2, a->imm); + return true; +}