xref: /openbmc/qemu/target/riscv/insn_trans/trans_rvzimop.c.inc (revision 0d9f1016d43302108d33d1268304a06cc3fb2021)
1*6eab278dSLIU Zhiwei/*
2*6eab278dSLIU Zhiwei * RISC-V translation routines for May-Be-Operation(zimop).
3*6eab278dSLIU Zhiwei *
4*6eab278dSLIU Zhiwei * Copyright (c) 2024 Alibaba Group.
5*6eab278dSLIU Zhiwei *
6*6eab278dSLIU Zhiwei * This program is free software; you can redistribute it and/or modify it
7*6eab278dSLIU Zhiwei * under the terms and conditions of the GNU General Public License,
8*6eab278dSLIU Zhiwei * version 2 or later, as published by the Free Software Foundation.
9*6eab278dSLIU Zhiwei *
10*6eab278dSLIU Zhiwei * This program is distributed in the hope it will be useful, but WITHOUT
11*6eab278dSLIU Zhiwei * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12*6eab278dSLIU Zhiwei * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13*6eab278dSLIU Zhiwei * more details.
14*6eab278dSLIU Zhiwei *
15*6eab278dSLIU Zhiwei * You should have received a copy of the GNU General Public License along with
16*6eab278dSLIU Zhiwei * this program.  If not, see <http://www.gnu.org/licenses/>.
17*6eab278dSLIU Zhiwei */
18*6eab278dSLIU Zhiwei
19*6eab278dSLIU Zhiwei#define REQUIRE_ZIMOP(ctx) do {           \
20*6eab278dSLIU Zhiwei    if (!ctx->cfg_ptr->ext_zimop) {       \
21*6eab278dSLIU Zhiwei        return false;                     \
22*6eab278dSLIU Zhiwei    }                                     \
23*6eab278dSLIU Zhiwei} while (0)
24*6eab278dSLIU Zhiwei
25*6eab278dSLIU Zhiweistatic bool trans_mop_r_n(DisasContext *ctx, arg_mop_r_n *a)
26*6eab278dSLIU Zhiwei{
27*6eab278dSLIU Zhiwei    REQUIRE_ZIMOP(ctx);
28*6eab278dSLIU Zhiwei    gen_set_gpr(ctx, a->rd, ctx->zero);
29*6eab278dSLIU Zhiwei    return true;
30*6eab278dSLIU Zhiwei}
31*6eab278dSLIU Zhiwei
32*6eab278dSLIU Zhiweistatic bool trans_mop_rr_n(DisasContext *ctx, arg_mop_rr_n *a)
33*6eab278dSLIU Zhiwei{
34*6eab278dSLIU Zhiwei    REQUIRE_ZIMOP(ctx);
35*6eab278dSLIU Zhiwei    gen_set_gpr(ctx, a->rd, ctx->zero);
36*6eab278dSLIU Zhiwei    return true;
37*6eab278dSLIU Zhiwei}
38