1// Copyright (c) 2007 The Hewlett-Packard Development Company
2// Copyright (c) 2012-13 Mark D. Hill and David A. Wood
3// Copyright (c) 2015 Advanced Micro Devices, Inc.
4//
5// All rights reserved.
6//
7// The license below extends only to copyright in the software and shall
8// not be construed as granting a license to any other intellectual
9// property including but not limited to intellectual property relating
10// to a hardware implementation of the functionality of the software
11// licensed hereunder. You may use the software subject to the license
12// terms below provided that you ensure that this notice is replicated
13// unmodified and in its entirety in all distributions of the software,
14// modified or unmodified, in source code or in binary form.
15//
16// Redistribution and use in source and binary forms, with or without
17// modification, are permitted provided that the following conditions are
18// met: redistributions of source code must retain the above copyright
19// notice, this list of conditions and the following disclaimer;
20// redistributions in binary form must reproduce the above copyright
21// notice, this list of conditions and the following disclaimer in the
22// documentation and/or other materials provided with the distribution;
23// neither the name of the copyright holders nor the names of its
24// contributors may be used to endorse or promote products derived from
25// this software without specific prior written permission.
26//
27// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38//
39// Authors: Gabe Black
40// Nilay Vaish
41// Steve Reinhardt
42
43format WarnUnimpl {
44 0x1B: decode OPCODE_OP_BOTTOM3 {
45 0x0: decode MODRM_REG {
46 0x0: decode MODRM_MOD {
47 0x3: Inst::FADD1(Eq);
48 // 32-bit memory operand
49 default: Inst::FADD1(Md);
50 }
51 0x1: decode MODRM_MOD {
52 0x3: Inst::FMUL1(Eq);
53 default: Inst::FMUL1(Md);
54 }
55 0x2: fcom();
56 0x3: fcomp();
57 0x4: decode MODRM_MOD {
58 0x3: Inst::FSUB1(Eq);
59 default: Inst::FSUB1(Md);
60 }
61 0x5: fsubr();
62 0x6: decode MODRM_MOD {
63 0x3: Inst::FDIV1(Eq);
64 default: Inst::FDIV1(Md);
65 }
66 0x7: fdivr();
67 }
68 0x1: decode MODRM_REG {
69 0x0: decode MODRM_MOD {
70 0x3: Inst::FLD(Eq);
71 // 32-bit load
72 default: Inst::FLD(Md);
73 }
74 0x1: decode MODRM_MOD {
75 0x3: Inst::FXCH(Eq);
76 default: Inst::UD2();
77 }
78 0x2: decode MODRM_MOD {
79 0x3: decode MODRM_RM {
80 0x0: fnop();
81 default: Inst::UD2();
82 }
83 default: Inst::FST(Ed);
84 }
85 0x3: decode MODRM_MOD {
86 0x3: Inst::UD2();
87 default: Inst::FSTP(Ed);
88 }
89 0x4: decode MODRM_MOD {
90 0x3: decode MODRM_RM {
91 0x0: Inst::FCHS();
92 0x1: Inst::FABS();
93 0x4: ftst();
94 0x5: fxam();
95 default: Inst::UD2();
96 }
97 default: Inst::FLDENV(M);
98 }
99 0x5: decode MODRM_MOD {
100 0x3: decode MODRM_RM {
101 0x0: Inst::FLD1();
102 0x1: Inst::FLDL2T();
103 0x2: Inst::FLDL2E();
104 0x3: Inst::FLDPI();
105 0x4: Inst::FLDLG2();
106 0x5: Inst::FLDLN2();
107 0x6: Inst::FLDZ();
108 }
109 default: Inst::FLDCW(Mw);
110 }
111 0x6: decode MODRM_MOD {
112 0x3: decode MODRM_RM {
113 0x0: f2xm1();
114 0x1: Inst::FYL2X();
115 0x2: Inst::FPTAN();
116 0x3: fpatan();
117 0x4: fxtract();
118 0x5: Inst::FPREM1();
119 0x6: fdecstp();
120 0x7: fincstp();
121 }
122 default: Inst::FNSTENV(M);
123 }
124 0x7: decode MODRM_MOD {
125 0x3: decode MODRM_RM {
126 0x0: Inst::FPREM();
127 0x1: fyl2xp1();
128 0x2: fsqrt();
129 0x3: Inst::FSINCOS();
130 0x4: frndint();
131 0x5: fscale();
132 0x6: Inst::FSIN();
133 0x7: Inst::FCOS();
134 }
135 default: Inst::FNSTCW(Mw);
136 }
137 }
138 //0x2: esc2();
139 0x2: decode MODRM_REG {
140 0x0: decode MODRM_MOD {
141 0x3: fcmovb();
142 default: fiadd();
143 }
144 0x1: decode MODRM_MOD {
145 0x3: fcmove();
146 default: fimul();
147 }
148 0x2: decode MODRM_MOD {
149 0x3: fcmovbe();
150 default: ficom();
151 }
152 0x3: decode MODRM_MOD {
153 0x3: fcmovu();
154 default: ficomp();
155 }
156 0x4: decode MODRM_MOD {
157 0x3: Inst::UD2();
158 default: fisub();
159 }
160 0x5: decode MODRM_MOD {
161 0x3: decode MODRM_RM {
162 0x1: fucompp();
163 default: Inst::UD2();
164 }
165 default: fisubr();
166 }
167 0x6: decode MODRM_MOD {
168 0x3: Inst::UD2();
169 default: fidiv();
170 }
171 0x7: decode MODRM_MOD {
172 0x3: Inst::UD2();
173 default: fidivr();
174 }
175 }
176 //0x3: esc3();
177 0x3: decode MODRM_REG {
178 0x0: decode MODRM_MOD {
179 0x3: fcmovnb();
177 default: fild();
180 default: Inst::FILD(Md); // 32-bit int
181 }
182 0x1: decode MODRM_MOD {
183 0x3: fcmovne();
184 default: fisttp();
185 }
186 0x2: decode MODRM_MOD {
187 0x3: fcmovnbe();
188 default: fist();
189 }
190 0x3: decode MODRM_MOD {
191 0x3: fcmovnu();
192 default: fistp();
193 }
194 0x4: decode MODRM_MOD {
195 0x3: decode MODRM_RM {
196 0x2: fnclex();
197 0x3: fninit();
198 default: Inst::UD2();
199 }
200 default: Inst::UD2();
201 }
202 0x5: decode MODRM_MOD {
200 0x3: fucomi();
203 // 'R' insists on having a size qualifier, so I picked 'q',
204 // but I don't think it has any effect
205 0x3: Inst::FUCOMI(Rq);
206 // 80-bit load
207 default: Inst::FLD80(M);
208 }
209 0x6: decode MODRM_MOD {
210 0x3: fcomi();
211 default: Inst::UD2();
212 }
213 0x7: decode MODRM_MOD {
214 0x3: Inst::UD2();
215 default: Inst::FST80P(M);
216 }
217 }
218 //0x4: esc4();
219 0x4: decode MODRM_REG {
220 0x0: decode MODRM_MOD {
221 0x3: Inst::FADD2(Eq);
222 default: Inst::FADD2(Mq);
223 }
224 0x1: decode MODRM_MOD {
225 0x3: Inst::FMUL2(Eq);
226 default: Inst::FMUL2(Mq);
227 }
228 0x2: decode MODRM_MOD {
229 0x3: Inst::UD2();
230 default: fcom();
231 }
232 0x3: decode MODRM_MOD {
233 0x3: Inst::UD2();
234 default: fcomp();
235 }
236 0x4: decode MODRM_MOD {
237 0x3: fsubr();
238 default: Inst::FSUB2(Mq);
239 }
240 0x5: decode MODRM_MOD {
241 0x3: Inst::FSUB2(Eq);
242 default: fsubr();
243 }
244 0x6: decode MODRM_MOD {
245 0x3: fdivr();
246 default: Inst::FDIV2(Mq);
247 }
248 0x7: decode MODRM_MOD {
249 0x3: Inst::FDIV2(Eq);
250 default: fdivr();
251 }
252 }
253 //0x5: esc5();
254 0x5: decode MODRM_REG {
255 0x0: decode MODRM_MOD {
256 0x3: ffree();
257 // 64-bit load
258 default: Inst::FLD(Mq);
259 }
260 0x1: decode MODRM_MOD {
261 0x3: Inst::UD2();
262 default: fisttp();
263 }
264 0x2: decode MODRM_MOD {
265 0x3: Inst::FST(Eq);
266 default: Inst::FST(Mq);
267 }
268 0x3: decode MODRM_MOD {
269 0x3: Inst::FSTP(Eq);
270 default: Inst::FSTP(Mq);
271 }
272 0x4: decode MODRM_MOD {
273 0x3: fucom();
274 default: frstor();
275 }
276 0x5: decode MODRM_MOD {
277 0x3: fucomp();
278 default: Inst::UD2();
279 }
280 0x6: decode MODRM_MOD {
281 0x3: Inst::UD2();
282 default: fnsave();
283 }
284 0x7: decode MODRM_MOD {
285 0x3: Inst::UD2();
286 default: Inst::FNSTSW(Mw);
287 }
288 }
289 //0x6: esc6();
290 0x6: decode MODRM_REG {
291 0x0: decode MODRM_MOD {
292 0x3: decode MODRM_RM {
293 0x1: Inst::FADDP();
294 default: Inst::FADDP(Eq);
295 }
296 default: fiadd();
297 }
298 0x1: decode MODRM_MOD {
299 0x3: Inst::FMULP(Eq);
300 default: fimul();
301 }
302 0x2: decode MODRM_MOD {
303 0x3: Inst::UD2();
304 default: ficom();
305 }
306 0x3: decode MODRM_MOD {
307 0x3: decode MODRM_RM {
308 0x1: fcompp();
309 default: Inst::UD2();
310 }
311 default: ficomp();
312 }
313 0x4: decode MODRM_MOD {
314 0x3: fsubrp();
315 default: fisub();
316 }
317 0x5: decode MODRM_MOD {
318 0x3: decode MODRM_RM {
319 0x1: Inst::FSUBP();
320 default: Inst::FSUBP(Eq);
321 }
322 default: fisubr();
323 }
324 0x6: decode MODRM_MOD {
325 0x3: fdivrp();
326 default: fidiv();
327 }
328 0x7: decode MODRM_MOD {
329 0x3: Inst::FDIVP(Eq);
330 default: fidivr();
331 }
332 }
333 //0x7: esc7();
334 0x7: decode MODRM_REG {
335 0x0: decode MODRM_MOD {
336 // The ffreep instruction isn't entirely real. It should work
337 // the same as ffree but then also pop the register stack.
338 0x3: ffreep();
334 default: fild();
339 default: Inst::FILD(Mw); // 16-bit int
340 }
341 0x1: decode MODRM_MOD {
342 0x3: Inst::UD2();
343 default: fisttp();
344 }
345 0x2: decode MODRM_MOD {
346 0x3: Inst::UD2();
347 default: fist();
348 }
349 0x3: decode MODRM_MOD {
350 0x3: Inst::UD2();
351 default: fistp();
352 }
353 0x4: decode MODRM_MOD {
354 0x3: decode MODRM_RM {
355 0x0: Inst::FNSTSW(rAw);
356 default: Inst::UD2();
357 }
358 default: fbld();
359 }
360 0x5: decode MODRM_MOD {
356 0x3: fucomip();
357 default: fild();
361 // 'R' insists on having a size qualifier, so I picked 'q',
362 // but I don't think it has any effect
363 0x3: Inst::FUCOMIP(Rq);
364 default: Inst::FILD(Mq); // 64-bit int
365 }
366 0x6: decode MODRM_MOD {
367 0x3: fcomip();
368 default: fbstp();
369 }
370 0x7: decode MODRM_MOD {
371 0x3: Inst::UD2();
372 default: fistp();
373 }
374 }
375 }
376}