s390x: helper functions for system emulation
[qemu.git] / target-cris / crisv32-decode.h
blobed141de0b79f7c3193bd208062c817b3395bb9cc
1 /*
2 * CRIS insn decoding macros.
4 * Copyright (c) 2007 AXIS Communications AB
5 * Written by Edgar E. Iglesias.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 /* Convenient binary macros. */
22 #define HEX__(n) 0x##n##LU
23 #define B8__(x) ((x&0x0000000FLU)?1:0) \
24 + ((x&0x000000F0LU)?2:0) \
25 + ((x&0x00000F00LU)?4:0) \
26 + ((x&0x0000F000LU)?8:0) \
27 + ((x&0x000F0000LU)?16:0) \
28 + ((x&0x00F00000LU)?32:0) \
29 + ((x&0x0F000000LU)?64:0) \
30 + ((x&0xF0000000LU)?128:0)
31 #define B8(d) ((unsigned char)B8__(HEX__(d)))
33 /* Quick imm. */
34 #define DEC_BCCQ {B8(00000000), B8(11110000)}
35 #define DEC_ADDOQ {B8(00010000), B8(11110000)}
36 #define DEC_ADDQ {B8(00100000), B8(11111100)}
37 #define DEC_MOVEQ {B8(00100100), B8(11111100)}
38 #define DEC_SUBQ {B8(00101000), B8(11111100)}
39 #define DEC_CMPQ {B8(00101100), B8(11111100)}
40 #define DEC_ANDQ {B8(00110000), B8(11111100)}
41 #define DEC_ORQ {B8(00110100), B8(11111100)}
42 #define DEC_BTSTQ {B8(00111000), B8(11111110)}
43 #define DEC_ASRQ {B8(00111010), B8(11111110)}
44 #define DEC_LSLQ {B8(00111100), B8(11111110)}
45 #define DEC_LSRQ {B8(00111110), B8(11111110)}
47 /* Register. */
48 #define DEC_MOVU_R {B8(01000100), B8(11111110)}
49 #define DEC_MOVU_R {B8(01000100), B8(11111110)}
50 #define DEC_MOVS_R {B8(01000110), B8(11111110)}
51 #define DEC_MOVE_R {B8(01100100), B8(11111100)}
52 #define DEC_MOVE_RP {B8(01100011), B8(11111111)}
53 #define DEC_MOVE_PR {B8(01100111), B8(11111111)}
54 #define DEC_DSTEP_R {B8(01101111), B8(11111111)}
55 #define DEC_MOVE_RS {B8(10110111), B8(11111111)}
56 #define DEC_MOVE_SR {B8(11110111), B8(11111111)}
57 #define DEC_ADDU_R {B8(01000000), B8(11111110)}
58 #define DEC_ADDS_R {B8(01000010), B8(11111110)}
59 #define DEC_ADD_R {B8(01100000), B8(11111100)}
60 #define DEC_ADDI_R {B8(01010000), B8(11111100)}
61 #define DEC_MULS_R {B8(11010000), B8(11111100)}
62 #define DEC_MULU_R {B8(10010000), B8(11111100)}
63 #define DEC_ADDI_ACR {B8(01010100), B8(11111100)}
64 #define DEC_NEG_R {B8(01011000), B8(11111100)}
65 #define DEC_BOUND_R {B8(01011100), B8(11111100)}
66 #define DEC_SUBU_R {B8(01001000), B8(11111110)}
67 #define DEC_SUBS_R {B8(01001010), B8(11111110)}
68 #define DEC_SUB_R {B8(01101000), B8(11111100)}
69 #define DEC_CMP_R {B8(01101100), B8(11111100)}
70 #define DEC_AND_R {B8(01110000), B8(11111100)}
71 #define DEC_ABS_R {B8(01101011), B8(11111111)}
72 #define DEC_LZ_R {B8(01110011), B8(11111111)}
73 #define DEC_MCP_R {B8(01111111), B8(11111111)}
74 #define DEC_SWAP_R {B8(01110111), B8(11111111)}
75 #define DEC_XOR_R {B8(01111011), B8(11111111)}
76 #define DEC_LSL_R {B8(01001100), B8(11111100)}
77 #define DEC_LSR_R {B8(01111100), B8(11111100)}
78 #define DEC_ASR_R {B8(01111000), B8(11111100)}
79 #define DEC_OR_R {B8(01110100), B8(11111100)}
80 #define DEC_BTST_R {B8(01001111), B8(11111111)}
82 /* Fixed. */
83 #define DEC_SETF {B8(01011011), B8(11111111)}
84 #define DEC_CLEARF {B8(01011111), B8(11111111)}
86 /* Memory. */
87 #define DEC_ADDU_M {B8(10000000), B8(10111110)}
88 #define DEC_ADDS_M {B8(10000010), B8(10111110)}
89 #define DEC_MOVU_M {B8(10000100), B8(10111110)}
90 #define DEC_MOVS_M {B8(10000110), B8(10111110)}
91 #define DEC_SUBU_M {B8(10001000), B8(10111110)}
92 #define DEC_SUBS_M {B8(10001010), B8(10111110)}
93 #define DEC_CMPU_M {B8(10001100), B8(10111110)}
94 #define DEC_CMPS_M {B8(10001110), B8(10111110)}
95 #define DEC_ADDO_M {B8(10010100), B8(10111100)}
96 #define DEC_BOUND_M {B8(10011100), B8(10111100)}
97 #define DEC_ADD_M {B8(10100000), B8(10111100)}
98 #define DEC_MOVE_MR {B8(10100100), B8(10111100)}
99 #define DEC_SUB_M {B8(10101000), B8(10111100)}
100 #define DEC_CMP_M {B8(10101100), B8(10111100)}
101 #define DEC_AND_M {B8(10110000), B8(10111100)}
102 #define DEC_OR_M {B8(10110100), B8(10111100)}
103 #define DEC_TEST_M {B8(10111000), B8(10111100)}
104 #define DEC_MOVE_RM {B8(10111100), B8(10111100)}
106 #define DEC_ADDC_R {B8(01010111), B8(11111111)}
107 #define DEC_ADDC_MR {B8(10011010), B8(10111111)}
108 #define DEC_LAPCQ {B8(10010111), B8(11111111)}
109 #define DEC_LAPC_IM {B8(11010111), B8(11111111)}
111 #define DEC_MOVE_MP {B8(10100011), B8(10111111)}
112 #define DEC_MOVE_PM {B8(10100111), B8(10111111)}
114 #define DEC_SCC_R {B8(01010011), B8(11111111)}
115 #define DEC_RFE_ETC {B8(10010011), B8(11111111)}
116 #define DEC_JUMP_P {B8(10011111), B8(11111111)}
117 #define DEC_BCC_IM {B8(11011111), B8(11111111)}
118 #define DEC_JAS_R {B8(10011011), B8(11111111)}
119 #define DEC_JASC_R {B8(10110011), B8(11111111)}
120 #define DEC_JAS_IM {B8(11011011), B8(11111111)}
121 #define DEC_JASC_IM {B8(11110011), B8(11111111)}
122 #define DEC_BAS_IM {B8(11101011), B8(11111111)}
123 #define DEC_BASC_IM {B8(11101111), B8(11111111)}
124 #define DEC_MOVEM_MR {B8(10111011), B8(10111111)}
125 #define DEC_MOVEM_RM {B8(10111111), B8(10111111)}
127 #define DEC_FTAG_FIDX_D_M {B8(10101011), B8(11111111)}
128 #define DEC_FTAG_FIDX_I_M {B8(11010011), B8(11111111)}