xref: /openbmc/qemu/target/mips/tcg/rel6_translate.c (revision 0d70c5aa1bbfb0f5099d53d6e084337a8246cc0c)
1 /*
2  *  MIPS emulation for QEMU - Release 6 translation routines
3  *
4  *  Copyright (c) 2020 Philippe Mathieu-Daudé
5  *
6  * SPDX-License-Identifier: LGPL-2.1-or-later
7  *
8  * This code is licensed under the LGPL v2.1 or later.
9  */
10 
11 #include "qemu/osdep.h"
12 #include "translate.h"
13 
14 /* Include the auto-generated decoders.  */
15 #include "decode-rel6.c.inc"
16 
17 bool trans_REMOVED(DisasContext *ctx, arg_REMOVED *a)
18 {
19     gen_reserved_instruction(ctx);
20 
21     return true;
22 }
23 
24 static bool trans_LSA(DisasContext *ctx, arg_r *a)
25 {
26     return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa + 1);
27 }
28 
29 static bool trans_DLSA(DisasContext *ctx, arg_r *a)
30 {
31     if (TARGET_LONG_BITS != 64) {
32         return false;
33     }
34     return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa + 1);
35 }
36 
37 static bool trans_CRC32(DisasContext *ctx, arg_special3_crc *a)
38 {
39     if (unlikely(!ctx->crcp)
40         || unlikely((a->sz == 3) && (!(ctx->hflags & MIPS_HFLAG_64)))
41         || unlikely((a->c >= 2))) {
42         gen_reserved_instruction(ctx);
43         return true;
44     }
45     gen_crc32(ctx, a->rt, a->rs, a->rt, a->sz, a->c);
46     return true;
47 }
48