aboutsummaryrefslogtreecommitdiff
path: root/target/riscv/insn_trans
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@wdc.com>2020-08-12 12:13:19 -0700
committerAlistair Francis <alistair.francis@wdc.com>2020-08-25 09:11:35 -0700
commit8c5362acb573b8b1913238a5ddefdeef12f513a8 (patch)
tree60ea64b5e11dcd847a60ca41e7a1cb19cc9ccea0 /target/riscv/insn_trans
parent5a894dd7709f3b6a9f3e861dec71f78098bb3373 (diff)
target/riscv: Allow generating hlv/hlvx/hsv instructions
Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 477c864312280ea55a98dc84cb01d826751b6c14.1597259519.git.alistair.francis@wdc.com Message-Id: <477c864312280ea55a98dc84cb01d826751b6c14.1597259519.git.alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/insn_trans')
-rw-r--r--target/riscv/insn_trans/trans_rvh.c.inc340
1 files changed, 340 insertions, 0 deletions
diff --git a/target/riscv/insn_trans/trans_rvh.c.inc b/target/riscv/insn_trans/trans_rvh.c.inc
index 263b652d90..db650ae62a 100644
--- a/target/riscv/insn_trans/trans_rvh.c.inc
+++ b/target/riscv/insn_trans/trans_rvh.c.inc
@@ -16,6 +16,346 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
+static bool trans_hlv_b(DisasContext *ctx, arg_hlv_b *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_SB);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hlv_h(DisasContext *ctx, arg_hlv_h *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TESW);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hlv_w(DisasContext *ctx, arg_hlv_w *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TESL);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hlv_bu(DisasContext *ctx, arg_hlv_bu *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_UB);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hlv_hu(DisasContext *ctx, arg_hlv_hu *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TEUW);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hsv_b(DisasContext *ctx, arg_hsv_b *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv dat = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ gen_get_gpr(dat, a->rs2);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_SB);
+
+ gen_helper_hyp_store(cpu_env, t0, dat, mem_idx, memop);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(dat);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hsv_h(DisasContext *ctx, arg_hsv_h *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv dat = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ gen_get_gpr(dat, a->rs2);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TESW);
+
+ gen_helper_hyp_store(cpu_env, t0, dat, mem_idx, memop);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(dat);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hsv_w(DisasContext *ctx, arg_hsv_w *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv dat = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ gen_get_gpr(dat, a->rs2);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TESL);
+
+ gen_helper_hyp_store(cpu_env, t0, dat, mem_idx, memop);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(dat);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+#ifdef TARGET_RISCV64
+static bool trans_hlv_wu(DisasContext *ctx, arg_hlv_wu *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TEUL);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hlv_d(DisasContext *ctx, arg_hlv_d *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TEQ);
+
+ gen_helper_hyp_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hsv_d(DisasContext *ctx, arg_hsv_d *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv dat = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ gen_get_gpr(dat, a->rs2);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TEQ);
+
+ gen_helper_hyp_store(cpu_env, t0, dat, mem_idx, memop);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(dat);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+#endif
+
+static bool trans_hlvx_hu(DisasContext *ctx, arg_hlvx_hu *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TEUW);
+
+ gen_helper_hyp_x_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
+static bool trans_hlvx_wu(DisasContext *ctx, arg_hlvx_wu *a)
+{
+ REQUIRE_EXT(ctx, RVH);
+#ifndef CONFIG_USER_ONLY
+ TCGv t0 = tcg_temp_new();
+ TCGv t1 = tcg_temp_new();
+ TCGv mem_idx = tcg_temp_new();
+ TCGv memop = tcg_temp_new();
+
+ gen_get_gpr(t0, a->rs1);
+ tcg_gen_movi_tl(mem_idx, ctx->mem_idx);
+ tcg_gen_movi_tl(memop, MO_TEUL);
+
+ gen_helper_hyp_x_load(t1, cpu_env, t0, mem_idx, memop);
+ gen_set_gpr(a->rd, t1);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ tcg_temp_free(mem_idx);
+ tcg_temp_free(memop);
+ return true;
+#else
+ return false;
+#endif
+}
+
static bool trans_hfence_gvma(DisasContext *ctx, arg_sfence_vma *a)
{
REQUIRE_EXT(ctx, RVH);