target/riscv: rvv: Add mask agnostic for vector mask instructions
[qemu.git] / target / riscv / insn_trans / trans_xventanacondops.c.inc
blob16849e6d4e081bedd95dd2ea18cfc2af1a83389a
1 /*
2  * RISC-V translation routines for the XVentanaCondOps extension.
3  *
4  * Copyright (c) 2021-2022 VRULL GmbH.
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  */
19 static bool gen_vt_condmask(DisasContext *ctx, arg_r *a, TCGCond cond)
21     TCGv dest = dest_gpr(ctx, a->rd);
22     TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
23     TCGv src2 = get_gpr(ctx, a->rs2, EXT_NONE);
25     tcg_gen_movcond_tl(cond, dest, src2, ctx->zero, src1, ctx->zero);
27     gen_set_gpr(ctx, a->rd, dest);
28     return true;
31 static bool trans_vt_maskc(DisasContext *ctx, arg_r *a)
33     return gen_vt_condmask(ctx, a, TCG_COND_NE);
36 static bool trans_vt_maskcn(DisasContext *ctx, arg_r *a)
38     return gen_vt_condmask(ctx, a, TCG_COND_EQ);