target/mips/tx79: Move PCPYH opcode to decodetree
[qemu/ar7.git] / target / mips / tx79_translate.c
blobd58b4fcd7b3bbe705b8439308c0b9ac1dfce1f84
1 /*
2 * Toshiba TX79-specific instructions translation routines
4 * Copyright (c) 2018 Fredrik Noring
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
9 #include "qemu/osdep.h"
10 #include "tcg/tcg-op.h"
11 #include "exec/helper-gen.h"
12 #include "translate.h"
14 /* Include the auto-generated decoder. */
15 #include "decode-tx79.c.inc"
17 bool decode_ext_tx79(DisasContext *ctx, uint32_t insn)
19 if (TARGET_LONG_BITS == 64 && decode_tx79(ctx, insn)) {
20 return true;
22 return false;
25 static bool trans_MFHI1(DisasContext *ctx, arg_rtype *a)
27 gen_store_gpr(cpu_HI[1], a->rd);
29 return true;
32 static bool trans_MFLO1(DisasContext *ctx, arg_rtype *a)
34 gen_store_gpr(cpu_LO[1], a->rd);
36 return true;
39 static bool trans_MTHI1(DisasContext *ctx, arg_rtype *a)
41 gen_load_gpr(cpu_HI[1], a->rs);
43 return true;
46 static bool trans_MTLO1(DisasContext *ctx, arg_rtype *a)
48 gen_load_gpr(cpu_LO[1], a->rs);
50 return true;
53 /* Parallel Copy Halfword */
54 static bool trans_PCPYH(DisasContext *s, arg_rtype *a)
56 if (a->rd == 0) {
57 /* nop */
58 return true;
61 if (a->rt == 0) {
62 tcg_gen_movi_i64(cpu_gpr[a->rd], 0);
63 tcg_gen_movi_i64(cpu_gpr_hi[a->rd], 0);
64 return true;
67 tcg_gen_deposit_i64(cpu_gpr[a->rd], cpu_gpr[a->rt], cpu_gpr[a->rt], 16, 16);
68 tcg_gen_deposit_i64(cpu_gpr[a->rd], cpu_gpr[a->rd], cpu_gpr[a->rd], 32, 32);
69 tcg_gen_deposit_i64(cpu_gpr_hi[a->rd], cpu_gpr_hi[a->rt], cpu_gpr_hi[a->rt], 16, 16);
70 tcg_gen_deposit_i64(cpu_gpr_hi[a->rd], cpu_gpr_hi[a->rd], cpu_gpr_hi[a->rd], 32, 32);
72 return true;