]>
git.proxmox.com Git - mirror_qemu.git/blob - target/mips/tcg/octeon_translate.c
2 * Octeon-specific instructions translation routines
4 * Copyright (c) 2022 Pavel Dovgalyuk
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #include "qemu/osdep.h"
10 #include "tcg/tcg-op.h"
11 #include "tcg/tcg-op-gvec.h"
12 #include "exec/helper-gen.h"
13 #include "translate.h"
15 /* Include the auto-generated decoder. */
16 #include "decode-octeon.c.inc"
18 static bool trans_BBIT(DisasContext
*ctx
, arg_BBIT
*a
)
22 if (ctx
->hflags
& MIPS_HFLAG_BMASK
) {
23 LOG_DISAS("Branch in delay / forbidden slot at PC 0x"
24 TARGET_FMT_lx
"\n", ctx
->base
.pc_next
);
25 generate_exception_end(ctx
, EXCP_RI
);
29 /* Load needed operands */
30 TCGv t0
= tcg_temp_new();
31 gen_load_gpr(t0
, a
->rs
);
33 p
= tcg_constant_tl(1ULL << a
->p
);
35 tcg_gen_and_tl(bcond
, p
, t0
);
37 tcg_gen_andc_tl(bcond
, p
, t0
);
40 ctx
->hflags
|= MIPS_HFLAG_BC
;
41 ctx
->btarget
= ctx
->base
.pc_next
+ 4 + a
->offset
* 4;
42 ctx
->hflags
|= MIPS_HFLAG_BDS32
;
48 static bool trans_BADDU(DisasContext
*ctx
, arg_BADDU
*a
)
59 gen_load_gpr(t0
, a
->rs
);
60 gen_load_gpr(t1
, a
->rt
);
62 tcg_gen_add_tl(t0
, t0
, t1
);
63 tcg_gen_andi_i64(cpu_gpr
[a
->rd
], t0
, 0xff);
71 static bool trans_DMUL(DisasContext
*ctx
, arg_DMUL
*a
)
82 gen_load_gpr(t0
, a
->rs
);
83 gen_load_gpr(t1
, a
->rt
);
85 tcg_gen_mul_i64(cpu_gpr
[a
->rd
], t0
, t1
);
93 static bool trans_EXTS(DisasContext
*ctx
, arg_EXTS
*a
)
103 gen_load_gpr(t0
, a
->rs
);
104 tcg_gen_sextract_tl(t0
, t0
, a
->p
, a
->lenm1
+ 1);
105 gen_store_gpr(t0
, a
->rt
);
111 static bool trans_CINS(DisasContext
*ctx
, arg_CINS
*a
)
121 gen_load_gpr(t0
, a
->rs
);
122 tcg_gen_deposit_z_tl(t0
, t0
, a
->p
, a
->lenm1
+ 1);
123 gen_store_gpr(t0
, a
->rt
);
129 static bool trans_POP(DisasContext
*ctx
, arg_POP
*a
)
139 gen_load_gpr(t0
, a
->rs
);
141 tcg_gen_andi_i64(t0
, t0
, 0xffffffff);
143 tcg_gen_ctpop_tl(t0
, t0
);
144 gen_store_gpr(t0
, a
->rd
);
150 static bool trans_SEQNE(DisasContext
*ctx
, arg_SEQNE
*a
)
162 gen_load_gpr(t0
, a
->rs
);
163 gen_load_gpr(t1
, a
->rt
);
166 tcg_gen_setcond_tl(TCG_COND_NE
, cpu_gpr
[a
->rd
], t1
, t0
);
168 tcg_gen_setcond_tl(TCG_COND_EQ
, cpu_gpr
[a
->rd
], t1
, t0
);
177 static bool trans_SEQNEI(DisasContext
*ctx
, arg_SEQNEI
*a
)
188 gen_load_gpr(t0
, a
->rs
);
190 /* Sign-extend to 64 bit value */
191 target_ulong imm
= a
->imm
;
193 tcg_gen_setcondi_tl(TCG_COND_NE
, cpu_gpr
[a
->rt
], t0
, imm
);
195 tcg_gen_setcondi_tl(TCG_COND_EQ
, cpu_gpr
[a
->rt
], t0
, imm
);