Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging
[qemu/ar7.git] / target-ppc / translate / vmx-ops.inc.c
blobcc7ed7eeed76b35cc2a3538ebbe645c7957d46d8
1 #define GEN_VR_LDX(name, opc2, opc3) \
2 GEN_HANDLER(name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC)
3 #define GEN_VR_STX(name, opc2, opc3) \
4 GEN_HANDLER(st##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC)
5 #define GEN_VR_LVE(name, opc2, opc3) \
6 GEN_HANDLER(lve##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC)
7 #define GEN_VR_STVE(name, opc2, opc3) \
8 GEN_HANDLER(stve##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC)
9 GEN_VR_LDX(lvx, 0x07, 0x03),
10 GEN_VR_LDX(lvxl, 0x07, 0x0B),
11 GEN_VR_LVE(bx, 0x07, 0x00),
12 GEN_VR_LVE(hx, 0x07, 0x01),
13 GEN_VR_LVE(wx, 0x07, 0x02),
14 GEN_VR_STX(svx, 0x07, 0x07),
15 GEN_VR_STX(svxl, 0x07, 0x0F),
16 GEN_VR_STVE(bx, 0x07, 0x04),
17 GEN_VR_STVE(hx, 0x07, 0x05),
18 GEN_VR_STVE(wx, 0x07, 0x06),
20 #define GEN_VX_LOGICAL(name, tcg_op, opc2, opc3) \
21 GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_ALTIVEC)
23 #define GEN_VX_LOGICAL_207(name, tcg_op, opc2, opc3) \
24 GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ALTIVEC_207)
26 GEN_VX_LOGICAL(vand, tcg_gen_and_i64, 2, 16),
27 GEN_VX_LOGICAL(vandc, tcg_gen_andc_i64, 2, 17),
28 GEN_VX_LOGICAL(vor, tcg_gen_or_i64, 2, 18),
29 GEN_VX_LOGICAL(vxor, tcg_gen_xor_i64, 2, 19),
30 GEN_VX_LOGICAL(vnor, tcg_gen_nor_i64, 2, 20),
31 GEN_VX_LOGICAL_207(veqv, tcg_gen_eqv_i64, 2, 26),
32 GEN_VX_LOGICAL_207(vnand, tcg_gen_nand_i64, 2, 22),
33 GEN_VX_LOGICAL_207(vorc, tcg_gen_orc_i64, 2, 21),
35 #define GEN_VXFORM(name, opc2, opc3) \
36 GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_ALTIVEC)
38 #define GEN_VXFORM_207(name, opc2, opc3) \
39 GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ALTIVEC_207)
41 #define GEN_VXFORM_300(name, opc2, opc3) \
42 GEN_HANDLER_E(name, 0x04, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300)
44 #define GEN_VXFORM_300_EXT(name, opc2, opc3, inval) \
45 GEN_HANDLER_E(name, 0x04, opc2, opc3, inval, PPC_NONE, PPC2_ISA300)
47 #define GEN_VXFORM_300_EO(name, opc2, opc3, opc4) \
48 GEN_HANDLER_E_2(name, 0x04, opc2, opc3, opc4, 0x00000000, PPC_NONE, \
49 PPC2_ISA300)
51 #define GEN_VXFORM_DUAL(name0, name1, opc2, opc3, type0, type1) \
52 GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x00000000, type0, type1)
54 #define GEN_VXRFORM_DUAL(name0, name1, opc2, opc3, tp0, tp1) \
55 GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x00000000, tp0, tp1), \
56 GEN_HANDLER_E(name0##_##name1, 0x4, opc2, (opc3 | 0x10), 0x00000000, tp0, tp1),
58 GEN_VXFORM_DUAL(vaddubm, vmul10cuq, 0, 0, PPC_ALTIVEC, PPC_NONE),
59 GEN_VXFORM_DUAL(vadduhm, vmul10ecuq, 0, 1, PPC_ALTIVEC, PPC_NONE),
60 GEN_VXFORM(vadduwm, 0, 2),
61 GEN_VXFORM_207(vaddudm, 0, 3),
62 GEN_VXFORM_DUAL(vsububm, bcdadd, 0, 16, PPC_ALTIVEC, PPC_NONE),
63 GEN_VXFORM_DUAL(vsubuhm, bcdsub, 0, 17, PPC_ALTIVEC, PPC_NONE),
64 GEN_VXFORM(vsubuwm, 0, 18),
65 GEN_VXFORM_207(vsubudm, 0, 19),
66 GEN_VXFORM(vmaxub, 1, 0),
67 GEN_VXFORM(vmaxuh, 1, 1),
68 GEN_VXFORM(vmaxuw, 1, 2),
69 GEN_VXFORM_207(vmaxud, 1, 3),
70 GEN_VXFORM(vmaxsb, 1, 4),
71 GEN_VXFORM(vmaxsh, 1, 5),
72 GEN_VXFORM(vmaxsw, 1, 6),
73 GEN_VXFORM_207(vmaxsd, 1, 7),
74 GEN_VXFORM(vminub, 1, 8),
75 GEN_VXFORM(vminuh, 1, 9),
76 GEN_VXFORM(vminuw, 1, 10),
77 GEN_VXFORM_207(vminud, 1, 11),
78 GEN_VXFORM(vminsb, 1, 12),
79 GEN_VXFORM(vminsh, 1, 13),
80 GEN_VXFORM(vminsw, 1, 14),
81 GEN_VXFORM_207(vminsd, 1, 15),
82 GEN_VXFORM_DUAL(vavgub, vabsdub, 1, 16, PPC_ALTIVEC, PPC_NONE),
83 GEN_VXFORM_DUAL(vavguh, vabsduh, 1, 17, PPC_ALTIVEC, PPC_NONE),
84 GEN_VXFORM_DUAL(vavguw, vabsduw, 1, 18, PPC_ALTIVEC, PPC_NONE),
85 GEN_VXFORM(vavgsb, 1, 20),
86 GEN_VXFORM(vavgsh, 1, 21),
87 GEN_VXFORM(vavgsw, 1, 22),
88 GEN_VXFORM(vmrghb, 6, 0),
89 GEN_VXFORM(vmrghh, 6, 1),
90 GEN_VXFORM(vmrghw, 6, 2),
91 GEN_VXFORM(vmrglb, 6, 4),
92 GEN_VXFORM(vmrglh, 6, 5),
93 GEN_VXFORM(vmrglw, 6, 6),
94 GEN_VXFORM_207(vmrgew, 6, 30),
95 GEN_VXFORM_207(vmrgow, 6, 26),
96 GEN_VXFORM(vmuloub, 4, 0),
97 GEN_VXFORM(vmulouh, 4, 1),
98 GEN_VXFORM_DUAL(vmulouw, vmuluwm, 4, 2, PPC_ALTIVEC, PPC_NONE),
99 GEN_VXFORM(vmulosb, 4, 4),
100 GEN_VXFORM(vmulosh, 4, 5),
101 GEN_VXFORM_207(vmulosw, 4, 6),
102 GEN_VXFORM(vmuleub, 4, 8),
103 GEN_VXFORM(vmuleuh, 4, 9),
104 GEN_VXFORM_207(vmuleuw, 4, 10),
105 GEN_VXFORM(vmulesb, 4, 12),
106 GEN_VXFORM(vmulesh, 4, 13),
107 GEN_VXFORM_207(vmulesw, 4, 14),
108 GEN_VXFORM(vslb, 2, 4),
109 GEN_VXFORM(vslh, 2, 5),
110 GEN_VXFORM(vslw, 2, 6),
111 GEN_VXFORM_207(vsld, 2, 23),
112 GEN_VXFORM(vsrb, 2, 8),
113 GEN_VXFORM(vsrh, 2, 9),
114 GEN_VXFORM(vsrw, 2, 10),
115 GEN_VXFORM_207(vsrd, 2, 27),
116 GEN_VXFORM(vsrab, 2, 12),
117 GEN_VXFORM(vsrah, 2, 13),
118 GEN_VXFORM(vsraw, 2, 14),
119 GEN_VXFORM_207(vsrad, 2, 15),
120 GEN_VXFORM_300(vsrv, 2, 28),
121 GEN_VXFORM_300(vslv, 2, 29),
122 GEN_VXFORM(vslo, 6, 16),
123 GEN_VXFORM(vsro, 6, 17),
124 GEN_VXFORM(vaddcuw, 0, 6),
125 GEN_VXFORM(vsubcuw, 0, 22),
126 GEN_VXFORM_DUAL(vaddubs, vmul10uq, 0, 8, PPC_ALTIVEC, PPC_NONE),
127 GEN_VXFORM_DUAL(vadduhs, vmul10euq, 0, 9, PPC_ALTIVEC, PPC_NONE),
128 GEN_VXFORM(vadduws, 0, 10),
129 GEN_VXFORM(vaddsbs, 0, 12),
130 GEN_VXFORM(vaddshs, 0, 13),
131 GEN_VXFORM(vaddsws, 0, 14),
132 GEN_VXFORM_DUAL(vsububs, bcdadd, 0, 24, PPC_ALTIVEC, PPC_NONE),
133 GEN_VXFORM_DUAL(vsubuhs, bcdsub, 0, 25, PPC_ALTIVEC, PPC_NONE),
134 GEN_VXFORM(vsubuws, 0, 26),
135 GEN_VXFORM(vsubsbs, 0, 28),
136 GEN_VXFORM(vsubshs, 0, 29),
137 GEN_VXFORM(vsubsws, 0, 30),
138 GEN_VXFORM_207(vadduqm, 0, 4),
139 GEN_VXFORM_207(vaddcuq, 0, 5),
140 GEN_VXFORM_DUAL(vaddeuqm, vaddecuq, 30, 0xFF, PPC_NONE, PPC2_ALTIVEC_207),
141 GEN_VXFORM_207(vsubuqm, 0, 20),
142 GEN_VXFORM_207(vsubcuq, 0, 21),
143 GEN_VXFORM_DUAL(vsubeuqm, vsubecuq, 31, 0xFF, PPC_NONE, PPC2_ALTIVEC_207),
144 GEN_VXFORM(vrlb, 2, 0),
145 GEN_VXFORM(vrlh, 2, 1),
146 GEN_VXFORM(vrlw, 2, 2),
147 GEN_VXFORM_207(vrld, 2, 3),
148 GEN_VXFORM(vsl, 2, 7),
149 GEN_VXFORM(vsr, 2, 11),
150 GEN_VXFORM(vpkuhum, 7, 0),
151 GEN_VXFORM(vpkuwum, 7, 1),
152 GEN_VXFORM_207(vpkudum, 7, 17),
153 GEN_VXFORM(vpkuhus, 7, 2),
154 GEN_VXFORM(vpkuwus, 7, 3),
155 GEN_VXFORM_207(vpkudus, 7, 19),
156 GEN_VXFORM(vpkshus, 7, 4),
157 GEN_VXFORM(vpkswus, 7, 5),
158 GEN_VXFORM_207(vpksdus, 7, 21),
159 GEN_VXFORM(vpkshss, 7, 6),
160 GEN_VXFORM(vpkswss, 7, 7),
161 GEN_VXFORM_207(vpksdss, 7, 23),
162 GEN_VXFORM(vpkpx, 7, 12),
163 GEN_VXFORM(vsum4ubs, 4, 24),
164 GEN_VXFORM(vsum4sbs, 4, 28),
165 GEN_VXFORM(vsum4shs, 4, 25),
166 GEN_VXFORM(vsum2sws, 4, 26),
167 GEN_VXFORM(vsumsws, 4, 30),
168 GEN_VXFORM(vaddfp, 5, 0),
169 GEN_VXFORM(vsubfp, 5, 1),
170 GEN_VXFORM(vmaxfp, 5, 16),
171 GEN_VXFORM(vminfp, 5, 17),
173 #define GEN_VXRFORM1(opname, name, str, opc2, opc3) \
174 GEN_HANDLER2(name, str, 0x4, opc2, opc3, 0x00000000, PPC_ALTIVEC),
175 #define GEN_VXRFORM1_300(opname, name, str, opc2, opc3) \
176 GEN_HANDLER2_E(name, str, 0x4, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300),
177 #define GEN_VXRFORM(name, opc2, opc3) \
178 GEN_VXRFORM1(name, name, #name, opc2, opc3) \
179 GEN_VXRFORM1(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4)))
180 #define GEN_VXRFORM_300(name, opc2, opc3) \
181 GEN_VXRFORM1_300(name, name, #name, opc2, opc3) \
182 GEN_VXRFORM1_300(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4)))
184 GEN_VXRFORM_300(vcmpnezb, 3, 4)
185 GEN_VXRFORM_300(vcmpnezh, 3, 5)
186 GEN_VXRFORM_300(vcmpnezw, 3, 6)
187 GEN_VXRFORM(vcmpgtsb, 3, 12)
188 GEN_VXRFORM(vcmpgtsh, 3, 13)
189 GEN_VXRFORM(vcmpgtsw, 3, 14)
190 GEN_VXRFORM(vcmpgtub, 3, 8)
191 GEN_VXRFORM(vcmpgtuh, 3, 9)
192 GEN_VXRFORM(vcmpgtuw, 3, 10)
193 GEN_VXRFORM_DUAL(vcmpeqfp, vcmpequd, 3, 3, PPC_ALTIVEC, PPC_NONE)
194 GEN_VXRFORM(vcmpgefp, 3, 7)
195 GEN_VXRFORM_DUAL(vcmpgtfp, vcmpgtud, 3, 11, PPC_ALTIVEC, PPC_NONE)
196 GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE)
197 GEN_VXRFORM_DUAL(vcmpequb, vcmpneb, 3, 0, PPC_ALTIVEC, PPC_NONE)
198 GEN_VXRFORM_DUAL(vcmpequh, vcmpneh, 3, 1, PPC_ALTIVEC, PPC_NONE)
199 GEN_VXRFORM_DUAL(vcmpequw, vcmpnew, 3, 2, PPC_ALTIVEC, PPC_NONE)
201 #define GEN_VXFORM_DUAL_INV(name0, name1, opc2, opc3, inval0, inval1, type) \
202 GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, \
203 PPC_NONE)
204 GEN_VXFORM_DUAL_INV(vspltb, vextractub, 6, 8, 0x00000000, 0x100000,
205 PPC_ALTIVEC),
206 GEN_VXFORM_DUAL_INV(vsplth, vextractuh, 6, 9, 0x00000000, 0x100000,
207 PPC_ALTIVEC),
208 GEN_VXFORM_DUAL_INV(vspltw, vextractuw, 6, 10, 0x00000000, 0x100000,
209 PPC_ALTIVEC),
210 GEN_VXFORM_300_EXT(vextractd, 6, 11, 0x100000),
211 GEN_VXFORM_DUAL_INV(vspltisb, vinsertb, 6, 12, 0x00000000, 0x100000,
212 PPC_ALTIVEC),
213 GEN_VXFORM_DUAL_INV(vspltish, vinserth, 6, 13, 0x00000000, 0x100000,
214 PPC_ALTIVEC),
215 GEN_VXFORM_DUAL_INV(vspltisw, vinsertw, 6, 14, 0x00000000, 0x100000,
216 PPC_ALTIVEC),
217 GEN_VXFORM_300_EXT(vinsertd, 6, 15, 0x100000),
218 GEN_VXFORM_300_EO(vnegw, 0x01, 0x18, 0x06),
219 GEN_VXFORM_300_EO(vnegd, 0x01, 0x18, 0x07),
220 GEN_VXFORM_300_EO(vextsb2w, 0x01, 0x18, 0x10),
221 GEN_VXFORM_300_EO(vextsh2w, 0x01, 0x18, 0x11),
222 GEN_VXFORM_300_EO(vextsb2d, 0x01, 0x18, 0x18),
223 GEN_VXFORM_300_EO(vextsh2d, 0x01, 0x18, 0x19),
224 GEN_VXFORM_300_EO(vextsw2d, 0x01, 0x18, 0x1A),
225 GEN_VXFORM_300_EO(vctzb, 0x01, 0x18, 0x1C),
226 GEN_VXFORM_300_EO(vctzh, 0x01, 0x18, 0x1D),
227 GEN_VXFORM_300_EO(vctzw, 0x01, 0x18, 0x1E),
228 GEN_VXFORM_300_EO(vctzd, 0x01, 0x18, 0x1F),
229 GEN_VXFORM_300_EO(vclzlsbb, 0x01, 0x18, 0x0),
230 GEN_VXFORM_300_EO(vctzlsbb, 0x01, 0x18, 0x1),
231 GEN_VXFORM_300(vpermr, 0x1D, 0xFF),
233 #define GEN_VXFORM_NOA(name, opc2, opc3) \
234 GEN_HANDLER(name, 0x04, opc2, opc3, 0x001f0000, PPC_ALTIVEC)
235 GEN_VXFORM_NOA(vupkhsb, 7, 8),
236 GEN_VXFORM_NOA(vupkhsh, 7, 9),
237 GEN_VXFORM_207(vupkhsw, 7, 25),
238 GEN_VXFORM_NOA(vupklsb, 7, 10),
239 GEN_VXFORM_NOA(vupklsh, 7, 11),
240 GEN_VXFORM_207(vupklsw, 7, 27),
241 GEN_VXFORM_NOA(vupkhpx, 7, 13),
242 GEN_VXFORM_NOA(vupklpx, 7, 15),
243 GEN_VXFORM_NOA(vrefp, 5, 4),
244 GEN_VXFORM_NOA(vrsqrtefp, 5, 5),
245 GEN_VXFORM_NOA(vexptefp, 5, 6),
246 GEN_VXFORM_NOA(vlogefp, 5, 7),
247 GEN_VXFORM_NOA(vrfim, 5, 11),
248 GEN_VXFORM_NOA(vrfin, 5, 8),
249 GEN_VXFORM_NOA(vrfip, 5, 10),
250 GEN_VXFORM_NOA(vrfiz, 5, 9),
252 #define GEN_VXFORM_UIMM(name, opc2, opc3) \
253 GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_ALTIVEC)
254 GEN_VXFORM_UIMM(vcfux, 5, 12),
255 GEN_VXFORM_UIMM(vcfsx, 5, 13),
256 GEN_VXFORM_UIMM(vctuxs, 5, 14),
257 GEN_VXFORM_UIMM(vctsxs, 5, 15),
260 #define GEN_VAFORM_PAIRED(name0, name1, opc2) \
261 GEN_HANDLER(name0##_##name1, 0x04, opc2, 0xFF, 0x00000000, PPC_ALTIVEC)
262 GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16),
263 GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18),
264 GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19),
265 GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20),
266 GEN_VAFORM_PAIRED(vsel, vperm, 21),
267 GEN_VAFORM_PAIRED(vmaddfp, vnmsubfp, 23),
269 GEN_VXFORM_DUAL(vclzb, vpopcntb, 1, 28, PPC_NONE, PPC2_ALTIVEC_207),
270 GEN_VXFORM_DUAL(vclzh, vpopcnth, 1, 29, PPC_NONE, PPC2_ALTIVEC_207),
271 GEN_VXFORM_DUAL(vclzw, vpopcntw, 1, 30, PPC_NONE, PPC2_ALTIVEC_207),
272 GEN_VXFORM_DUAL(vclzd, vpopcntd, 1, 31, PPC_NONE, PPC2_ALTIVEC_207),
274 GEN_VXFORM_300(vbpermd, 6, 23),
275 GEN_VXFORM_207(vbpermq, 6, 21),
276 GEN_VXFORM_207(vgbbd, 6, 20),
277 GEN_VXFORM_207(vpmsumb, 4, 16),
278 GEN_VXFORM_207(vpmsumh, 4, 17),
279 GEN_VXFORM_207(vpmsumw, 4, 18),
280 GEN_VXFORM_207(vpmsumd, 4, 19),
282 GEN_VXFORM_207(vsbox, 4, 23),
284 GEN_VXFORM_DUAL(vcipher, vcipherlast, 4, 20, PPC_NONE, PPC2_ALTIVEC_207),
285 GEN_VXFORM_DUAL(vncipher, vncipherlast, 4, 21, PPC_NONE, PPC2_ALTIVEC_207),
287 GEN_VXFORM_207(vshasigmaw, 1, 26),
288 GEN_VXFORM_207(vshasigmad, 1, 27),
290 GEN_VXFORM_DUAL(vsldoi, vpermxor, 22, 0xFF, PPC_ALTIVEC, PPC_NONE),