2 * Toshiba TX79-specific instructions translation routines
4 * Copyright (c) 2018 Fredrik Noring
6 * SPDX-License-Identifier: GPL-2.0-or-later
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
)) {
25 static bool trans_MFHI1(DisasContext
*ctx
, arg_rtype
*a
)
27 gen_store_gpr(cpu_HI
[1], a
->rd
);
32 static bool trans_MFLO1(DisasContext
*ctx
, arg_rtype
*a
)
34 gen_store_gpr(cpu_LO
[1], a
->rd
);
39 static bool trans_MTHI1(DisasContext
*ctx
, arg_rtype
*a
)
41 gen_load_gpr(cpu_HI
[1], a
->rs
);
46 static bool trans_MTLO1(DisasContext
*ctx
, arg_rtype
*a
)
48 gen_load_gpr(cpu_LO
[1], a
->rs
);
53 /* Parallel Copy Halfword */
54 static bool trans_PCPYH(DisasContext
*s
, arg_rtype
*a
)
62 tcg_gen_movi_i64(cpu_gpr
[a
->rd
], 0);
63 tcg_gen_movi_i64(cpu_gpr_hi
[a
->rd
], 0);
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);
75 /* Parallel Copy Lower Doubleword */
76 static bool trans_PCPYLD(DisasContext
*s
, arg_rtype
*a
)
84 tcg_gen_movi_i64(cpu_gpr_hi
[a
->rd
], 0);
86 tcg_gen_mov_i64(cpu_gpr_hi
[a
->rd
], cpu_gpr
[a
->rs
]);
90 tcg_gen_movi_i64(cpu_gpr
[a
->rd
], 0);
91 } else if (a
->rd
!= a
->rt
) {
92 tcg_gen_mov_i64(cpu_gpr
[a
->rd
], cpu_gpr
[a
->rt
]);
98 /* Parallel Copy Upper Doubleword */
99 static bool trans_PCPYUD(DisasContext
*s
, arg_rtype
*a
)
106 gen_load_gpr_hi(cpu_gpr
[a
->rd
], a
->rs
);
109 tcg_gen_movi_i64(cpu_gpr_hi
[a
->rd
], 0);
110 } else if (a
->rd
!= a
->rt
) {
111 tcg_gen_mov_i64(cpu_gpr_hi
[a
->rd
], cpu_gpr_hi
[a
->rt
]);