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