]> Git Repo - qemu.git/blob - target/arm/sve.decode
target/arm: Implement SVE Index Generation Group
[qemu.git] / target / arm / sve.decode
1 # AArch64 SVE instruction descriptions
2 #
3 #  Copyright (c) 2017 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
22 ###########################################################################
23 # Named fields.  These are primarily for disjoint fields.
24
25 %imm6_22_5      22:1 5:5
26 %imm9_16_10     16:s6 10:3
27
28 # A combination of tsz:imm3 -- extract esize.
29 %tszimm_esz     22:2 5:5 !function=tszimm_esz
30 # A combination of tsz:imm3 -- extract (2 * esize) - (tsz:imm3)
31 %tszimm_shr     22:2 5:5 !function=tszimm_shr
32 # A combination of tsz:imm3 -- extract (tsz:imm3) - esize
33 %tszimm_shl     22:2 5:5 !function=tszimm_shl
34
35 # Either a copy of rd (at bit 0), or a different source
36 # as propagated via the MOVPRFX instruction.
37 %reg_movprfx    0:5
38
39 ###########################################################################
40 # Named attribute sets.  These are used to make nice(er) names
41 # when creating helpers common to those for the individual
42 # instruction patterns.
43
44 &rr_esz         rd rn esz
45 &rri            rd rn imm
46 &rrr_esz        rd rn rm esz
47 &rpr_esz        rd pg rn esz
48 &rprr_s         rd pg rn rm s
49 &rprr_esz       rd pg rn rm esz
50 &rprrr_esz      rd pg rn rm ra esz
51 &rpri_esz       rd pg rn imm esz
52
53 ###########################################################################
54 # Named instruction formats.  These are generally used to
55 # reduce the amount of duplication between instruction patterns.
56
57 # Two operand with unused vector element size
58 @pd_pn_e0       ........ ........ ....... rn:4 . rd:4           &rr_esz esz=0
59
60 # Two operand
61 @pd_pn          ........ esz:2 .. .... ....... rn:4 . rd:4      &rr_esz
62
63 # Three operand with unused vector element size
64 @rd_rn_rm_e0    ........ ... rm:5 ... ... rn:5 rd:5             &rrr_esz esz=0
65
66 # Three predicate operand, with governing predicate, flag setting
67 @pd_pg_pn_pm_s  ........ . s:1 .. rm:4 .. pg:4 . rn:4 . rd:4    &rprr_s
68
69 # Three operand, vector element size
70 @rd_rn_rm       ........ esz:2 . rm:5 ... ... rn:5 rd:5         &rrr_esz
71
72 # Two register operand, with governing predicate, vector element size
73 @rdn_pg_rm      ........ esz:2 ... ... ... pg:3 rm:5 rd:5 \
74                 &rprr_esz rn=%reg_movprfx
75 @rdm_pg_rn      ........ esz:2 ... ... ... pg:3 rn:5 rd:5 \
76                 &rprr_esz rm=%reg_movprfx
77
78 # Three register operand, with governing predicate, vector element size
79 @rda_pg_rn_rm   ........ esz:2 . rm:5  ... pg:3 rn:5 rd:5 \
80                 &rprrr_esz ra=%reg_movprfx
81 @rdn_pg_ra_rm   ........ esz:2 . rm:5  ... pg:3 ra:5 rd:5 \
82                 &rprrr_esz rn=%reg_movprfx
83
84 # One register operand, with governing predicate, vector element size
85 @rd_pg_rn       ........ esz:2 ... ... ... pg:3 rn:5 rd:5       &rpr_esz
86
87 # Two register operand, one immediate operand, with predicate,
88 # element size encoded as TSZHL.  User must fill in imm.
89 @rdn_pg_tszimm  ........ .. ... ... ... pg:3 ..... rd:5 \
90                 &rpri_esz rn=%reg_movprfx esz=%tszimm_esz
91
92 # Basic Load/Store with 9-bit immediate offset
93 @pd_rn_i9       ........ ........ ...... rn:5 . rd:4    \
94                 &rri imm=%imm9_16_10
95 @rd_rn_i9       ........ ........ ...... rn:5 rd:5      \
96                 &rri imm=%imm9_16_10
97
98 ###########################################################################
99 # Instruction patterns.  Grouped according to the SVE encodingindex.xhtml.
100
101 ### SVE Integer Arithmetic - Binary Predicated Group
102
103 # SVE bitwise logical vector operations (predicated)
104 ORR_zpzz        00000100 .. 011 000 000 ... ..... .....   @rdn_pg_rm
105 EOR_zpzz        00000100 .. 011 001 000 ... ..... .....   @rdn_pg_rm
106 AND_zpzz        00000100 .. 011 010 000 ... ..... .....   @rdn_pg_rm
107 BIC_zpzz        00000100 .. 011 011 000 ... ..... .....   @rdn_pg_rm
108
109 # SVE integer add/subtract vectors (predicated)
110 ADD_zpzz        00000100 .. 000 000 000 ... ..... .....   @rdn_pg_rm
111 SUB_zpzz        00000100 .. 000 001 000 ... ..... .....   @rdn_pg_rm
112 SUB_zpzz        00000100 .. 000 011 000 ... ..... .....   @rdm_pg_rn # SUBR
113
114 # SVE integer min/max/difference (predicated)
115 SMAX_zpzz       00000100 .. 001 000 000 ... ..... .....   @rdn_pg_rm
116 UMAX_zpzz       00000100 .. 001 001 000 ... ..... .....   @rdn_pg_rm
117 SMIN_zpzz       00000100 .. 001 010 000 ... ..... .....   @rdn_pg_rm
118 UMIN_zpzz       00000100 .. 001 011 000 ... ..... .....   @rdn_pg_rm
119 SABD_zpzz       00000100 .. 001 100 000 ... ..... .....   @rdn_pg_rm
120 UABD_zpzz       00000100 .. 001 101 000 ... ..... .....   @rdn_pg_rm
121
122 # SVE integer multiply/divide (predicated)
123 MUL_zpzz        00000100 .. 010 000 000 ... ..... .....   @rdn_pg_rm
124 SMULH_zpzz      00000100 .. 010 010 000 ... ..... .....   @rdn_pg_rm
125 UMULH_zpzz      00000100 .. 010 011 000 ... ..... .....   @rdn_pg_rm
126 # Note that divide requires size >= 2; below 2 is unallocated.
127 SDIV_zpzz       00000100 .. 010 100 000 ... ..... .....   @rdn_pg_rm
128 UDIV_zpzz       00000100 .. 010 101 000 ... ..... .....   @rdn_pg_rm
129 SDIV_zpzz       00000100 .. 010 110 000 ... ..... .....   @rdm_pg_rn # SDIVR
130 UDIV_zpzz       00000100 .. 010 111 000 ... ..... .....   @rdm_pg_rn # UDIVR
131
132 ### SVE Integer Reduction Group
133
134 # SVE bitwise logical reduction (predicated)
135 ORV             00000100 .. 011 000 001 ... ..... .....         @rd_pg_rn
136 EORV            00000100 .. 011 001 001 ... ..... .....         @rd_pg_rn
137 ANDV            00000100 .. 011 010 001 ... ..... .....         @rd_pg_rn
138
139 # SVE integer add reduction (predicated)
140 # Note that saddv requires size != 3.
141 UADDV           00000100 .. 000 001 001 ... ..... .....         @rd_pg_rn
142 SADDV           00000100 .. 000 000 001 ... ..... .....         @rd_pg_rn
143
144 # SVE integer min/max reduction (predicated)
145 SMAXV           00000100 .. 001 000 001 ... ..... .....         @rd_pg_rn
146 UMAXV           00000100 .. 001 001 001 ... ..... .....         @rd_pg_rn
147 SMINV           00000100 .. 001 010 001 ... ..... .....         @rd_pg_rn
148 UMINV           00000100 .. 001 011 001 ... ..... .....         @rd_pg_rn
149
150 ### SVE Shift by Immediate - Predicated Group
151
152 # SVE bitwise shift by immediate (predicated)
153 ASR_zpzi        00000100 .. 000 000 100 ... .. ... ..... \
154                 @rdn_pg_tszimm imm=%tszimm_shr
155 LSR_zpzi        00000100 .. 000 001 100 ... .. ... ..... \
156                 @rdn_pg_tszimm imm=%tszimm_shr
157 LSL_zpzi        00000100 .. 000 011 100 ... .. ... ..... \
158                 @rdn_pg_tszimm imm=%tszimm_shl
159 ASRD            00000100 .. 000 100 100 ... .. ... ..... \
160                 @rdn_pg_tszimm imm=%tszimm_shr
161
162 # SVE bitwise shift by vector (predicated)
163 ASR_zpzz        00000100 .. 010 000 100 ... ..... .....   @rdn_pg_rm
164 LSR_zpzz        00000100 .. 010 001 100 ... ..... .....   @rdn_pg_rm
165 LSL_zpzz        00000100 .. 010 011 100 ... ..... .....   @rdn_pg_rm
166 ASR_zpzz        00000100 .. 010 100 100 ... ..... .....   @rdm_pg_rn # ASRR
167 LSR_zpzz        00000100 .. 010 101 100 ... ..... .....   @rdm_pg_rn # LSRR
168 LSL_zpzz        00000100 .. 010 111 100 ... ..... .....   @rdm_pg_rn # LSLR
169
170 # SVE bitwise shift by wide elements (predicated)
171 # Note these require size != 3.
172 ASR_zpzw        00000100 .. 011 000 100 ... ..... .....         @rdn_pg_rm
173 LSR_zpzw        00000100 .. 011 001 100 ... ..... .....         @rdn_pg_rm
174 LSL_zpzw        00000100 .. 011 011 100 ... ..... .....         @rdn_pg_rm
175
176 ### SVE Integer Arithmetic - Unary Predicated Group
177
178 # SVE unary bit operations (predicated)
179 # Note esz != 0 for FABS and FNEG.
180 CLS             00000100 .. 011 000 101 ... ..... .....         @rd_pg_rn
181 CLZ             00000100 .. 011 001 101 ... ..... .....         @rd_pg_rn
182 CNT_zpz         00000100 .. 011 010 101 ... ..... .....         @rd_pg_rn
183 CNOT            00000100 .. 011 011 101 ... ..... .....         @rd_pg_rn
184 NOT_zpz         00000100 .. 011 110 101 ... ..... .....         @rd_pg_rn
185 FABS            00000100 .. 011 100 101 ... ..... .....         @rd_pg_rn
186 FNEG            00000100 .. 011 101 101 ... ..... .....         @rd_pg_rn
187
188 # SVE integer unary operations (predicated)
189 # Note esz > original size for extensions.
190 ABS             00000100 .. 010 110 101 ... ..... .....         @rd_pg_rn
191 NEG             00000100 .. 010 111 101 ... ..... .....         @rd_pg_rn
192 SXTB            00000100 .. 010 000 101 ... ..... .....         @rd_pg_rn
193 UXTB            00000100 .. 010 001 101 ... ..... .....         @rd_pg_rn
194 SXTH            00000100 .. 010 010 101 ... ..... .....         @rd_pg_rn
195 UXTH            00000100 .. 010 011 101 ... ..... .....         @rd_pg_rn
196 SXTW            00000100 .. 010 100 101 ... ..... .....         @rd_pg_rn
197 UXTW            00000100 .. 010 101 101 ... ..... .....         @rd_pg_rn
198
199 ### SVE Integer Multiply-Add Group
200
201 # SVE integer multiply-add writing addend (predicated)
202 MLA             00000100 .. 0 ..... 010 ... ..... .....   @rda_pg_rn_rm
203 MLS             00000100 .. 0 ..... 011 ... ..... .....   @rda_pg_rn_rm
204
205 # SVE integer multiply-add writing multiplicand (predicated)
206 MLA             00000100 .. 0 ..... 110 ... ..... .....   @rdn_pg_ra_rm # MAD
207 MLS             00000100 .. 0 ..... 111 ... ..... .....   @rdn_pg_ra_rm # MSB
208
209 ### SVE Integer Arithmetic - Unpredicated Group
210
211 # SVE integer add/subtract vectors (unpredicated)
212 ADD_zzz         00000100 .. 1 ..... 000 000 ..... .....         @rd_rn_rm
213 SUB_zzz         00000100 .. 1 ..... 000 001 ..... .....         @rd_rn_rm
214 SQADD_zzz       00000100 .. 1 ..... 000 100 ..... .....         @rd_rn_rm
215 UQADD_zzz       00000100 .. 1 ..... 000 101 ..... .....         @rd_rn_rm
216 SQSUB_zzz       00000100 .. 1 ..... 000 110 ..... .....         @rd_rn_rm
217 UQSUB_zzz       00000100 .. 1 ..... 000 111 ..... .....         @rd_rn_rm
218
219 ### SVE Logical - Unpredicated Group
220
221 # SVE bitwise logical operations (unpredicated)
222 AND_zzz         00000100 00 1 ..... 001 100 ..... .....         @rd_rn_rm_e0
223 ORR_zzz         00000100 01 1 ..... 001 100 ..... .....         @rd_rn_rm_e0
224 EOR_zzz         00000100 10 1 ..... 001 100 ..... .....         @rd_rn_rm_e0
225 BIC_zzz         00000100 11 1 ..... 001 100 ..... .....         @rd_rn_rm_e0
226
227 ### SVE Index Generation Group
228
229 # SVE index generation (immediate start, immediate increment)
230 INDEX_ii        00000100 esz:2 1 imm2:s5 010000 imm1:s5 rd:5
231
232 # SVE index generation (immediate start, register increment)
233 INDEX_ir        00000100 esz:2 1 rm:5 010010 imm:s5 rd:5
234
235 # SVE index generation (register start, immediate increment)
236 INDEX_ri        00000100 esz:2 1 imm:s5 010001 rn:5 rd:5
237
238 # SVE index generation (register start, register increment)
239 INDEX_rr        00000100 .. 1 ..... 010011 ..... .....          @rd_rn_rm
240
241 ### SVE Predicate Logical Operations Group
242
243 # SVE predicate logical operations
244 AND_pppp        00100101 0. 00 .... 01 .... 0 .... 0 ....       @pd_pg_pn_pm_s
245 BIC_pppp        00100101 0. 00 .... 01 .... 0 .... 1 ....       @pd_pg_pn_pm_s
246 EOR_pppp        00100101 0. 00 .... 01 .... 1 .... 0 ....       @pd_pg_pn_pm_s
247 SEL_pppp        00100101 0. 00 .... 01 .... 1 .... 1 ....       @pd_pg_pn_pm_s
248 ORR_pppp        00100101 1. 00 .... 01 .... 0 .... 0 ....       @pd_pg_pn_pm_s
249 ORN_pppp        00100101 1. 00 .... 01 .... 0 .... 1 ....       @pd_pg_pn_pm_s
250 NOR_pppp        00100101 1. 00 .... 01 .... 1 .... 0 ....       @pd_pg_pn_pm_s
251 NAND_pppp       00100101 1. 00 .... 01 .... 1 .... 1 ....       @pd_pg_pn_pm_s
252
253 ### SVE Predicate Misc Group
254
255 # SVE predicate test
256 PTEST           00100101 01 010000 11 pg:4 0 rn:4 0 0000
257
258 # SVE predicate initialize
259 PTRUE           00100101 esz:2 01100 s:1 111000 pat:5 0 rd:4
260
261 # SVE initialize FFR
262 SETFFR          00100101 0010 1100 1001 0000 0000 0000
263
264 # SVE zero predicate register
265 PFALSE          00100101 0001 1000 1110 0100 0000 rd:4
266
267 # SVE predicate read from FFR (predicated)
268 RDFFR_p         00100101 0 s:1 0110001111000 pg:4 0 rd:4
269
270 # SVE predicate read from FFR (unpredicated)
271 RDFFR           00100101 0001 1001 1111 0000 0000 rd:4
272
273 # SVE FFR write from predicate (WRFFR)
274 WRFFR           00100101 0010 1000 1001 000 rn:4 00000
275
276 # SVE predicate first active
277 PFIRST          00100101 01 011 000 11000 00 .... 0 ....        @pd_pn_e0
278
279 # SVE predicate next active
280 PNEXT           00100101 .. 011 001 11000 10 .... 0 ....        @pd_pn
281
282 ### SVE Memory - 32-bit Gather and Unsized Contiguous Group
283
284 # SVE load predicate register
285 LDR_pri         10000101 10 ...... 000 ... ..... 0 ....         @pd_rn_i9
286
287 # SVE load vector register
288 LDR_zri         10000101 10 ...... 010 ... ..... .....          @rd_rn_i9
This page took 0.040906 seconds and 4 git commands to generate.