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