1 /* 2 * Octeon-specific instructions translation routines 3 * 4 * Copyright (c) 2022 Pavel Dovgalyuk 5 * 6 * SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8 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" 14 15 /* Include the auto-generated decoder. */ 16 #include "decode-octeon.c.inc" 17 18 static bool trans_BBIT(DisasContext *ctx, arg_BBIT *a) 19 { 20 TCGv p; 21 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); 26 return true; 27 } 28 29 /* Load needed operands */ 30 TCGv t0 = tcg_temp_new(); 31 gen_load_gpr(t0, a->rs); 32 33 p = tcg_constant_tl(1ULL << a->p); 34 if (a->set) { 35 tcg_gen_and_tl(bcond, p, t0); 36 } else { 37 tcg_gen_andc_tl(bcond, p, t0); 38 } 39 40 ctx->hflags |= MIPS_HFLAG_BC; 41 ctx->btarget = ctx->base.pc_next + 4 + a->offset * 4; 42 ctx->hflags |= MIPS_HFLAG_BDS32; 43 44 tcg_temp_free(t0); 45 return true; 46 } 47