1 /*
2  * VR5432 extensions translation routines
3  *
4  * Reference: VR5432 Microprocessor User’s Manual
5  *            (Document Number U13751EU5V0UM00)
6  *
7  *  Copyright (c) 2021 Philippe Mathieu-Daudé
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #include "qemu/osdep.h"
13 #include "translate.h"
14 
15 /* Include the auto-generated decoder. */
16 #include "decode-vr54xx.c.inc"
17 
18 /*
19  * Integer Multiply-Accumulate Instructions
20  *
21  * MACC         Multiply, accumulate, and move LO
22  * MACCHI       Multiply, accumulate, and move HI
23  * MACCHIU      Unsigned multiply, accumulate, and move HI
24  * MACCU        Unsigned multiply, accumulate, and move LO
25  * MSAC         Multiply, negate, accumulate, and move LO
26  * MSACHI       Multiply, negate, accumulate, and move HI
27  * MSACHIU      Unsigned multiply, negate, accumulate, and move HI
28  * MSACU        Unsigned multiply, negate, accumulate, and move LO
29  * MULHI        Multiply and move HI
30  * MULHIU       Unsigned multiply and move HI
31  * MULS         Multiply, negate, and move LO
32  * MULSHI       Multiply, negate, and move HI
33  * MULSHIU      Unsigned multiply, negate, and move HI
34  * MULSU        Unsigned multiply, negate, and move LO
35  */
36 
37 static bool trans_mult_acc(DisasContext *ctx, arg_r *a,
38                            void (*gen_helper_mult_acc)(TCGv, TCGv_ptr, TCGv, TCGv))
39 {
40     TCGv t0 = tcg_temp_new();
41     TCGv t1 = tcg_temp_new();
42 
43     gen_load_gpr(t0, a->rs);
44     gen_load_gpr(t1, a->rt);
45 
46     gen_helper_mult_acc(t0, tcg_env, t0, t1);
47 
48     gen_store_gpr(t0, a->rd);
49     return true;
50 }
51 
52 TRANS(MACC,     trans_mult_acc, gen_helper_macc);
53 TRANS(MACCHI,   trans_mult_acc, gen_helper_macchi);
54 TRANS(MACCHIU,  trans_mult_acc, gen_helper_macchiu);
55 TRANS(MACCU,    trans_mult_acc, gen_helper_maccu);
56 TRANS(MSAC,     trans_mult_acc, gen_helper_msac);
57 TRANS(MSACHI,   trans_mult_acc, gen_helper_msachi);
58 TRANS(MSACHIU,  trans_mult_acc, gen_helper_msachiu);
59 TRANS(MSACU,    trans_mult_acc, gen_helper_msacu);
60 TRANS(MULHI,    trans_mult_acc, gen_helper_mulhi);
61 TRANS(MULHIU,   trans_mult_acc, gen_helper_mulhiu);
62 TRANS(MULS,     trans_mult_acc, gen_helper_muls);
63 TRANS(MULSHI,   trans_mult_acc, gen_helper_mulshi);
64 TRANS(MULSHIU,  trans_mult_acc, gen_helper_mulshiu);
65 TRANS(MULSU,    trans_mult_acc, gen_helper_mulsu);
66