]> Git Repo - qemu.git/blob - target/arm/a32.decode
target/arm: Convert CLZ
[qemu.git] / target / arm / a32.decode
1 # A32 conditional instructions
2 #
3 #  Copyright (c) 2019 Linaro, Ltd
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
17
18 #
19 # This file is processed by scripts/decodetree.py
20 #
21 # All of the insn that have a COND field in insn[31:28] are here.
22 # All insns that have 0xf in insn[31:28] are in a32-uncond.decode.
23 #
24
25 &empty
26 &s_rrr_shi       s rd rn rm shim shty
27 &s_rrr_shr       s rn rd rm rs shty
28 &s_rri_rot       s rn rd imm rot
29 &s_rrrr          s rd rn rm ra
30 &rrrr            rd rn rm ra
31 &rrr             rd rn rm
32 &rr              rd rm
33 &r               rm
34 &msr_reg         rn r mask
35 &mrs_reg         rd r
36 &msr_bank        rn r sysm
37 &mrs_bank        rd r sysm
38
39 # Data-processing (register)
40
41 @s_rrr_shi       ---- ... .... s:1 rn:4 rd:4 shim:5 shty:2 . rm:4 \
42                  &s_rrr_shi
43 @s_rxr_shi       ---- ... .... s:1 .... rd:4 shim:5 shty:2 . rm:4 \
44                  &s_rrr_shi rn=0
45 @S_xrr_shi       ---- ... .... .   rn:4 .... shim:5 shty:2 . rm:4 \
46                  &s_rrr_shi s=1 rd=0
47
48 AND_rrri         .... 000 0000 . .... .... ..... .. 0 ....    @s_rrr_shi
49 EOR_rrri         .... 000 0001 . .... .... ..... .. 0 ....    @s_rrr_shi
50 SUB_rrri         .... 000 0010 . .... .... ..... .. 0 ....    @s_rrr_shi
51 RSB_rrri         .... 000 0011 . .... .... ..... .. 0 ....    @s_rrr_shi
52 ADD_rrri         .... 000 0100 . .... .... ..... .. 0 ....    @s_rrr_shi
53 ADC_rrri         .... 000 0101 . .... .... ..... .. 0 ....    @s_rrr_shi
54 SBC_rrri         .... 000 0110 . .... .... ..... .. 0 ....    @s_rrr_shi
55 RSC_rrri         .... 000 0111 . .... .... ..... .. 0 ....    @s_rrr_shi
56 TST_xrri         .... 000 1000 1 .... 0000 ..... .. 0 ....    @S_xrr_shi
57 TEQ_xrri         .... 000 1001 1 .... 0000 ..... .. 0 ....    @S_xrr_shi
58 CMP_xrri         .... 000 1010 1 .... 0000 ..... .. 0 ....    @S_xrr_shi
59 CMN_xrri         .... 000 1011 1 .... 0000 ..... .. 0 ....    @S_xrr_shi
60 ORR_rrri         .... 000 1100 . .... .... ..... .. 0 ....    @s_rrr_shi
61 MOV_rxri         .... 000 1101 . 0000 .... ..... .. 0 ....    @s_rxr_shi
62 BIC_rrri         .... 000 1110 . .... .... ..... .. 0 ....    @s_rrr_shi
63 MVN_rxri         .... 000 1111 . 0000 .... ..... .. 0 ....    @s_rxr_shi
64
65 # Data-processing (register-shifted register)
66
67 @s_rrr_shr       ---- ... .... s:1 rn:4 rd:4 rs:4 . shty:2 . rm:4 \
68                  &s_rrr_shr
69 @s_rxr_shr       ---- ... .... s:1 .... rd:4 rs:4 . shty:2 . rm:4 \
70                  &s_rrr_shr rn=0
71 @S_xrr_shr       ---- ... .... .   rn:4 .... rs:4 . shty:2 . rm:4 \
72                  &s_rrr_shr rd=0 s=1
73
74 AND_rrrr         .... 000 0000 . .... .... .... 0 .. 1 ....   @s_rrr_shr
75 EOR_rrrr         .... 000 0001 . .... .... .... 0 .. 1 ....   @s_rrr_shr
76 SUB_rrrr         .... 000 0010 . .... .... .... 0 .. 1 ....   @s_rrr_shr
77 RSB_rrrr         .... 000 0011 . .... .... .... 0 .. 1 ....   @s_rrr_shr
78 ADD_rrrr         .... 000 0100 . .... .... .... 0 .. 1 ....   @s_rrr_shr
79 ADC_rrrr         .... 000 0101 . .... .... .... 0 .. 1 ....   @s_rrr_shr
80 SBC_rrrr         .... 000 0110 . .... .... .... 0 .. 1 ....   @s_rrr_shr
81 RSC_rrrr         .... 000 0111 . .... .... .... 0 .. 1 ....   @s_rrr_shr
82 TST_xrrr         .... 000 1000 1 .... 0000 .... 0 .. 1 ....   @S_xrr_shr
83 TEQ_xrrr         .... 000 1001 1 .... 0000 .... 0 .. 1 ....   @S_xrr_shr
84 CMP_xrrr         .... 000 1010 1 .... 0000 .... 0 .. 1 ....   @S_xrr_shr
85 CMN_xrrr         .... 000 1011 1 .... 0000 .... 0 .. 1 ....   @S_xrr_shr
86 ORR_rrrr         .... 000 1100 . .... .... .... 0 .. 1 ....   @s_rrr_shr
87 MOV_rxrr         .... 000 1101 . 0000 .... .... 0 .. 1 ....   @s_rxr_shr
88 BIC_rrrr         .... 000 1110 . .... .... .... 0 .. 1 ....   @s_rrr_shr
89 MVN_rxrr         .... 000 1111 . 0000 .... .... 0 .. 1 ....   @s_rxr_shr
90
91 # Data-processing (immediate)
92
93 %a32extrot       8:4 !function=times_2
94
95 @s_rri_rot       ---- ... .... s:1 rn:4 rd:4 .... imm:8 \
96                  &s_rri_rot rot=%a32extrot
97 @s_rxi_rot       ---- ... .... s:1 .... rd:4 .... imm:8 \
98                  &s_rri_rot rot=%a32extrot rn=0
99 @S_xri_rot       ---- ... .... .   rn:4 .... .... imm:8 \
100                  &s_rri_rot rot=%a32extrot rd=0 s=1
101
102 AND_rri          .... 001 0000 . .... .... ............       @s_rri_rot
103 EOR_rri          .... 001 0001 . .... .... ............       @s_rri_rot
104 SUB_rri          .... 001 0010 . .... .... ............       @s_rri_rot
105 RSB_rri          .... 001 0011 . .... .... ............       @s_rri_rot
106 ADD_rri          .... 001 0100 . .... .... ............       @s_rri_rot
107 ADC_rri          .... 001 0101 . .... .... ............       @s_rri_rot
108 SBC_rri          .... 001 0110 . .... .... ............       @s_rri_rot
109 RSC_rri          .... 001 0111 . .... .... ............       @s_rri_rot
110 TST_xri          .... 001 1000 1 .... 0000 ............       @S_xri_rot
111 TEQ_xri          .... 001 1001 1 .... 0000 ............       @S_xri_rot
112 CMP_xri          .... 001 1010 1 .... 0000 ............       @S_xri_rot
113 CMN_xri          .... 001 1011 1 .... 0000 ............       @S_xri_rot
114 ORR_rri          .... 001 1100 . .... .... ............       @s_rri_rot
115 MOV_rxi          .... 001 1101 . 0000 .... ............       @s_rxi_rot
116 BIC_rri          .... 001 1110 . .... .... ............       @s_rri_rot
117 MVN_rxi          .... 001 1111 . 0000 .... ............       @s_rxi_rot
118
119 # Multiply and multiply accumulate
120
121 @s_rdamn         ---- .... ... s:1 rd:4 ra:4 rm:4 .... rn:4   &s_rrrr
122 @s_rd0mn         ---- .... ... s:1 rd:4 .... rm:4 .... rn:4   &s_rrrr ra=0
123 @rdamn           ---- .... ... .   rd:4 ra:4 rm:4 .... rn:4   &rrrr
124 @rd0mn           ---- .... ... .   rd:4 .... rm:4 .... rn:4   &rrrr ra=0
125
126 MUL              .... 0000 000 . .... 0000 .... 1001 ....     @s_rd0mn
127 MLA              .... 0000 001 . .... .... .... 1001 ....     @s_rdamn
128 UMAAL            .... 0000 010 0 .... .... .... 1001 ....     @rdamn
129 MLS              .... 0000 011 0 .... .... .... 1001 ....     @rdamn
130 UMULL            .... 0000 100 . .... .... .... 1001 ....     @s_rdamn
131 UMLAL            .... 0000 101 . .... .... .... 1001 ....     @s_rdamn
132 SMULL            .... 0000 110 . .... .... .... 1001 ....     @s_rdamn
133 SMLAL            .... 0000 111 . .... .... .... 1001 ....     @s_rdamn
134
135 # Saturating addition and subtraction
136
137 @rndm            ---- .... .... rn:4 rd:4 .... .... rm:4      &rrr
138
139 QADD             .... 0001 0000 .... .... 0000 0101 ....      @rndm
140 QSUB             .... 0001 0010 .... .... 0000 0101 ....      @rndm
141 QDADD            .... 0001 0100 .... .... 0000 0101 ....      @rndm
142 QDSUB            .... 0001 0110 .... .... 0000 0101 ....      @rndm
143
144 # Halfword multiply and multiply accumulate
145
146 SMLABB           .... 0001 0000 .... .... .... 1000 ....      @rdamn
147 SMLABT           .... 0001 0000 .... .... .... 1100 ....      @rdamn
148 SMLATB           .... 0001 0000 .... .... .... 1010 ....      @rdamn
149 SMLATT           .... 0001 0000 .... .... .... 1110 ....      @rdamn
150 SMLAWB           .... 0001 0010 .... .... .... 1000 ....      @rdamn
151 SMULWB           .... 0001 0010 .... 0000 .... 1010 ....      @rd0mn
152 SMLAWT           .... 0001 0010 .... .... .... 1100 ....      @rdamn
153 SMULWT           .... 0001 0010 .... 0000 .... 1110 ....      @rd0mn
154 SMLALBB          .... 0001 0100 .... .... .... 1000 ....      @rdamn
155 SMLALBT          .... 0001 0100 .... .... .... 1100 ....      @rdamn
156 SMLALTB          .... 0001 0100 .... .... .... 1010 ....      @rdamn
157 SMLALTT          .... 0001 0100 .... .... .... 1110 ....      @rdamn
158 SMULBB           .... 0001 0110 .... 0000 .... 1000 ....      @rd0mn
159 SMULBT           .... 0001 0110 .... 0000 .... 1100 ....      @rd0mn
160 SMULTB           .... 0001 0110 .... 0000 .... 1010 ....      @rd0mn
161 SMULTT           .... 0001 0110 .... 0000 .... 1110 ....      @rd0mn
162
163 # MSR (immediate) and hints
164
165 &msr_i           r mask rot imm
166 @msr_i           ---- .... .... mask:4 .... rot:4 imm:8       &msr_i
167
168 {
169   {
170     YIELD        ---- 0011 0010 0000 1111 ---- 0000 0001
171     WFE          ---- 0011 0010 0000 1111 ---- 0000 0010
172     WFI          ---- 0011 0010 0000 1111 ---- 0000 0011
173
174     # TODO: Implement SEV, SEVL; may help SMP performance.
175     # SEV        ---- 0011 0010 0000 1111 ---- 0000 0100
176     # SEVL       ---- 0011 0010 0000 1111 ---- 0000 0101
177
178     # The canonical nop ends in 00000000, but the whole of the
179     # rest of the space executes as nop if otherwise unsupported.
180     NOP          ---- 0011 0010 0000 1111 ---- ---- ----
181   }
182   # Note mask = 0 is covered by NOP
183   MSR_imm        .... 0011 0010 .... 1111 .... .... ....      @msr_i r=0
184 }
185 MSR_imm          .... 0011 0110 .... 1111 .... .... ....      @msr_i r=1
186
187 # Cyclic Redundancy Check
188
189 CRC32B           .... 0001 0000 .... .... 0000 0100 ....      @rndm
190 CRC32H           .... 0001 0010 .... .... 0000 0100 ....      @rndm
191 CRC32W           .... 0001 0100 .... .... 0000 0100 ....      @rndm
192 CRC32CB          .... 0001 0000 .... .... 0010 0100 ....      @rndm
193 CRC32CH          .... 0001 0010 .... .... 0010 0100 ....      @rndm
194 CRC32CW          .... 0001 0100 .... .... 0010 0100 ....      @rndm
195
196 # Miscellaneous instructions
197
198 %sysm            8:1 16:4
199
200 @rm              ---- .... .... .... .... .... .... rm:4      &r
201 @rdm             ---- .... .... .... rd:4 .... .... rm:4      &rr
202
203 MRS_bank         ---- 0001 0 r:1 00 .... rd:4 001. 0000 0000  &mrs_bank %sysm
204 MSR_bank         ---- 0001 0 r:1 10 .... 1111 001. 0000 rn:4  &msr_bank %sysm
205
206 MRS_reg          ---- 0001 0 r:1 00 1111   rd:4 0000 0000 0000  &mrs_reg
207 MSR_reg          ---- 0001 0 r:1 10 mask:4 1111 0000 0000 rn:4  &msr_reg
208
209 BX               .... 0001 0010 1111 1111 1111 0001 ....      @rm
210 BXJ              .... 0001 0010 1111 1111 1111 0010 ....      @rm
211 BLX_r            .... 0001 0010 1111 1111 1111 0011 ....      @rm
212
213 CLZ              .... 0001 0110 1111 .... 1111 0001 ....      @rdm
This page took 0.037002 seconds and 4 git commands to generate.