From patchwork Tue Oct 23 12:04:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149447 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp613502ljp; Tue, 23 Oct 2018 05:10:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV63bnYDBYPAbj6TbpIBfouhkli6Oavjed85hIFaBCLrXsUySV9XbR6NyRm21ZDiznG/ZMjjn X-Received: by 2002:ac8:1307:: with SMTP id e7-v6mr48844773qtj.22.1540296649481; Tue, 23 Oct 2018 05:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540296649; cv=none; d=google.com; s=arc-20160816; b=a+YHfoyfH74AXgi2CL61QAbhaCM6cwU7FimApN5ZKaxBHs3ydMMFUFvdCMvW8gbuHt uPcMKSsXDVCStsb9tiB4FdWGmDtx9SsYNh1wsuYqrGW9hoRuPmracQOZscJ0E0bZPZCx mFl6rblGOtEdWGeomjxqEI764hLicqSMgKF3UR4EIPuvL8KKAuYpG4UAIBtpShCgSiQr 4siiJGuY5q9AqlRxpJEXdNOypzOObSRKvtoqlMzogh73H/E6t1b7JNzmWT3yDubLBTJE ga4fzPBktw5FJt3knfKiKo+yt0ToXeuImTIdoqADvibeDgFgHIYsy93aKcsjJnjA3QnW jU+g== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=RTaiyY8LfZoty6sS2ZcskVQFgv0plfpgxuAOOpuK5Ik=; b=phMohP+VCRtv7WvV1NCrXVAuC588j67g542glg+S4CK+BI+z638Mfl7WqhoBq342/Y mPwGWndF4yKKjv2gFA5PkQFRuQJZSLZrs0ngPJu/3fXu82S9Troqh0JlLZDrX8NDDDHK 0yRFPdj1X6xL2lUXrcYUACVZzHPZwDu5t5VqZD03vWl+NC8jN2ZbvDzbHOrEHDYLtyhZ KQNfnUZhvBN2UHSkcKMrxWD8OlZS4LQJFmFF8jC+cdtlJHLeM2gOa7UDRuTSIHX7Af0j qxUMCs2b05ImNlToiULUZnUGlqEsppC6Jn3BanGERfuyYgVmrTb5S91C45lQ76y7ZTCi 3irg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Vbery97x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g8si924682qvd.216.2018.10.23.05.10.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 23 Oct 2018 05:10:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Vbery97x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:40747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEvWK-0003MW-V6 for patch@linaro.org; Tue, 23 Oct 2018 08:10:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEvR2-00061O-Kk for qemu-devel@nongnu.org; Tue, 23 Oct 2018 08:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEvQv-0007h0-3L for qemu-devel@nongnu.org; Tue, 23 Oct 2018 08:05:15 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:34234) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEvQu-0007fr-Kr for qemu-devel@nongnu.org; Tue, 23 Oct 2018 08:05:12 -0400 Received: by mail-wm1-x331.google.com with SMTP id z25-v6so11464697wmf.1 for ; Tue, 23 Oct 2018 05:05:12 -0700 (PDT) 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; bh=RTaiyY8LfZoty6sS2ZcskVQFgv0plfpgxuAOOpuK5Ik=; b=Vbery97x2i0sg2JSeZttJ8wHU9g8K+nBC0wccqq8TemudTnJN8zrwwHXKiXzxLN/+m tsq/3i5tAf5sOG3UslgcdBQLUFVoCWTRKAGrFOgBU33wqWcjSBO1DXF9qc6vr6pjaXyv uJOo2ZIS5lTQJZg1pcvyTmRX5NMVPvZhdkrhw= 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=RTaiyY8LfZoty6sS2ZcskVQFgv0plfpgxuAOOpuK5Ik=; b=FF4PIeKY4j7TGewLoDzb6RCZ80CQv5qzHMmNyT+piNfaxNJDN5dg7HtSTXApNeMOiT 3m6671BRq9oBVW7q0OUbgQjXKwn/f2n4yt/7epnitfxL/HuriafAiC2REjxW2h9Aihla YEg7RkjXMXKpbNMDy4T6LVE6GczWSZ0QQIPeDPpVibWibEIRbTYPzqYdkQOTibZzoZzO /i5tR76RJWUHCNo9FY6Gy4hQtPJBuzpFFKJSQ7/IIY82+e6st0kEahDB9GBNOvT/BiVw oA/GgPCjCBFFb0l2NVE/V8xZP9Z0ctSqIwN5BDVE2f99R8QxBVMO+XX2EcJ0698WBgBZ JbfA== X-Gm-Message-State: ABuFfoi4IfhPUPqBzxmN1I/ShOrR4gdcew2Crioj5/LC9cOxfx5JgdMf Bv/BciW5P4avoCk78uQkRKjF45pwc8g= X-Received: by 2002:a1c:1a45:: with SMTP id a66-v6mr3646429wma.20.1540296311315; Tue, 23 Oct 2018 05:05:11 -0700 (PDT) Received: from cloudburst.twiddle.net.net ([185.7.230.213]) by smtp.gmail.com with ESMTPSA id a1-v6sm1009200wrt.79.2018.10.23.05.05.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 05:05:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 23 Oct 2018 13:04:53 +0100 Message-Id: <20181023120454.28553-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181023120454.28553-1-richard.henderson@linaro.org> References: <20181023120454.28553-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 Subject: [Qemu-devel] [PATCH 6/7] target/riscv: Convert @cl_d, @cl_w, @cs_d, @cs_w insns 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: sagark@eecs.berkeley.edu, kbastian@mail.uni-paderborn.de, palmer@sifive.com, peer.adelt@hni.uni-paderborn.de, Alistair.Francis@wdc.com, mjc@sifive.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" --- target/riscv/insn_trans/trans_rvc.inc.c | 34 +++---------------------- target/riscv/insn16.decode | 18 +++++++------ target/riscv/insn32.decode | 3 ++- 3 files changed, 16 insertions(+), 39 deletions(-) -- 2.17.2 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/riscv/insn_trans/trans_rvc.inc.c b/target/riscv/insn_trans/trans_rvc.inc.c index 152c1c9bca..c5ffb3bf7c 100644 --- a/target/riscv/insn_trans/trans_rvc.inc.c +++ b/target/riscv/insn_trans/trans_rvc.inc.c @@ -28,18 +28,6 @@ static bool trans_c_addi4spn(DisasContext *ctx, arg_c_addi4spn *a) return trans_addi(ctx, &arg); } -static bool trans_c_fld(DisasContext *ctx, arg_c_fld *a) -{ - arg_fld arg = { .rd = a->rd, .rs1 = a->rs1, .imm = a->uimm }; - return trans_fld(ctx, &arg); -} - -static bool trans_c_lw(DisasContext *ctx, arg_c_lw *a) -{ - arg_lw arg = { .rd = a->rd, .rs1 = a->rs1, .imm = a->uimm }; - return trans_lw(ctx, &arg); -} - static bool trans_c_flw_ld(DisasContext *ctx, arg_c_flw_ld *a) { #ifdef TARGET_RISCV32 @@ -50,25 +38,12 @@ static bool trans_c_flw_ld(DisasContext *ctx, arg_c_flw_ld *a) return trans_flw(ctx, &arg, insn); #else /* C.LD ( RV64C/RV128C-only ) */ - arg_c_fld tmp; + arg_i tmp; extract_cl_d(&tmp, 0); // FIXME - arg_ld arg = { .rd = tmp.rd, .rs1 = tmp.rs1, .imm = tmp.uimm }; - return trans_ld(ctx, &arg); + return trans_ld(ctx, &tmp); #endif } -static bool trans_c_fsd(DisasContext *ctx, arg_c_fsd *a) -{ - arg_fsd arg = { .rs1 = a->rs1, .rs2 = a->rs2, .imm = a->uimm }; - return trans_fsd(ctx, &arg); -} - -static bool trans_c_sw(DisasContext *ctx, arg_c_sw *a) -{ - arg_sw arg = { .rs1 = a->rs1, .rs2 = a->rs2, .imm = a->uimm }; - return trans_sw(ctx, &arg); -} - static bool trans_c_fsw_sd(DisasContext *ctx, arg_c_fsw_sd *a) { #ifdef TARGET_RISCV32 @@ -79,10 +54,9 @@ static bool trans_c_fsw_sd(DisasContext *ctx, arg_c_fsw_sd *a) return trans_fsw(ctx, &arg, insn); #else /* C.SD ( RV64C/RV128C-only ) */ - arg_c_fsd tmp; + arg_s tmp; extract_cs_d(&tmp, 0); // FIXME - arg_sd arg = { .rs1 = tmp.rs1, .rs2 = tmp.rs2, .imm = tmp.uimm }; - return trans_sd(ctx, &arg); + return trans_sd(ctx, &tmp); #endif } diff --git a/target/riscv/insn16.decode b/target/riscv/insn16.decode index 16525486ae..73b385ad19 100644 --- a/target/riscv/insn16.decode +++ b/target/riscv/insn16.decode @@ -41,6 +41,8 @@ # Argument sets imported from insn32.decode: &r rd rs1 rs2 !extern +&i imm rs1 rd !extern +&s imm rs1 rs2 !extern # Argument sets: &cl rs1 rd @@ -64,13 +66,13 @@ @cr .... ..... ..... .. &cr rs2=%rs2_5 %rd @ci ... . ..... ..... .. &ci imm=%imm_ci %rd @ciw ... ........ ... .. &ciw nzuimm=%nzuimm_ciw rd=%rs2_3 -@cl_d ... ... ... .. ... .. &cl_dw uimm=%uimm_cl_d rs1=%rs1_3 rd=%rs2_3 -@cl_w ... ... ... .. ... .. &cl_dw uimm=%uimm_cl_w rs1=%rs1_3 rd=%rs2_3 +@cl_d ... ... ... .. ... .. &i imm=%uimm_cl_d rs1=%rs1_3 rd=%rs2_3 +@cl_w ... ... ... .. ... .. &i imm=%uimm_cl_w rs1=%rs1_3 rd=%rs2_3 @cl ... ... ... .. ... .. &cl rs1=%rs1_3 rd=%rs2_3 @cs ... ... ... .. ... .. &cs rs1=%rs1_3 rs2=%rs2_3 @cs_2 ... ... ... .. ... .. &r rd=%rs1_3 rs1=%rs1_3 rs2=%rs2_3 -@cs_d ... ... ... .. ... .. &cs_dw uimm=%uimm_cl_d rs1=%rs1_3 rs2=%rs2_3 -@cs_w ... ... ... .. ... .. &cs_dw uimm=%uimm_cl_w rs1=%rs1_3 rs2=%rs2_3 +@cs_d ... ... ... .. ... .. &s imm=%uimm_cl_d rs1=%rs1_3 rs2=%rs2_3 +@cs_w ... ... ... .. ... .. &s imm=%uimm_cl_w rs1=%rs1_3 rs2=%rs2_3 @cb ... ... ... .. ... .. &cb imm=%imm_cb rs1=%rs1_3 @cj ... ........... .. &c_j imm=%imm_cj @@ -92,11 +94,11 @@ # *** RV64C Standard Extension (Quadrant 0) *** c_addi4spn 000 ........ ... 00 @ciw -c_fld 001 ... ... .. ... 00 @cl_d -c_lw 010 ... ... .. ... 00 @cl_w +fld 001 ... ... .. ... 00 @cl_d +lw 010 ... ... .. ... 00 @cl_w c_flw_ld 011 --- ... -- ... 00 @cl #Note: Must parse uimm manually -c_fsd 101 ... ... .. ... 00 @cs_d -c_sw 110 ... ... .. ... 00 @cs_w +fsd 101 ... ... .. ... 00 @cs_d +sw 110 ... ... .. ... 00 @cs_w c_fsw_sd 111 --- ... -- ... 00 @cs #Note: Must parse uimm manually # *** RV64C Standard Extension (Quadrant 1) *** diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index 77e093a060..e1fccc57c6 100644 --- a/target/riscv/insn32.decode +++ b/target/riscv/insn32.decode @@ -40,6 +40,7 @@ # Argument sets: &b imm rs2 rs1 &i imm rs1 rd +&s imm rs2 rs1 &r rd rs1 rs2 &shift shamt rs1 rd &atomic aq rl rs2 rs1 rd @@ -49,7 +50,7 @@ @r ....... ..... ..... ... ..... ....... &r %rs2 %rs1 %rd @i ............ ..... ... ..... ....... &i imm=%imm_i %rs1 %rd @b ....... ..... ..... ... ..... ....... &b imm=%imm_b %rs2 %rs1 -@s ....... ..... ..... ... ..... ....... imm=%imm_s %rs2 %rs1 +@s ....... ..... ..... ... ..... ....... &s imm=%imm_s %rs2 %rs1 @u .................... ..... ....... imm=%imm_u %rd @j .................... ..... ....... imm=%imm_j %rd