x87.isa revision 10044:42e058cae3d0
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: fmul();
49            0x2: fcom();
50            0x3: fcomp();
51            0x4: decode MODRM_MOD {
52                0x3: Inst::FSUB1(Eq);
53                default: Inst::FSUB1(Md);
54            }
55            0x5: fsubr();
56            0x6: fdiv();
57            0x7: fdivr();
58        }
59        0x1: decode MODRM_REG {
60            0x0: decode MODRM_MOD {
61                0x3: Inst::FLD(Eq);
62                // 32-bit load
63                default: Inst::FLD(Md);
64            }
65            0x1: decode MODRM_MOD {
66                0x3: Inst::FXCH(Eq);
67                default: Inst::UD2();
68            }
69            0x2: decode MODRM_MOD {
70                0x3: decode MODRM_RM {
71                    0x0: fnop();
72                    default: Inst::UD2();
73                }
74                default: Inst::FST(Ed);
75            }
76            0x3: decode MODRM_MOD {
77                0x3: Inst::UD2();
78                default: Inst::FSTP(Ed);
79            }
80            0x4: decode MODRM_MOD {
81                0x3: decode MODRM_RM {
82                    0x0: Inst::FCHS();
83                    0x1: Inst::FABS();
84                    0x4: ftst();
85                    0x5: fxam();
86                    default: Inst::UD2();
87                }
88                default: Inst::FLDENV(M);
89            }
90            0x5: decode MODRM_MOD {
91                0x3: decode MODRM_RM {
92                    0x0: Inst::FLD1();
93                    0x1: Inst::FLDL2T();
94                    0x2: Inst::FLDL2E();
95                    0x3: Inst::FLDPI();
96                    0x4: Inst::FLDLG2();
97                    0x5: Inst::FLDLN2();
98                    0x6: Inst::FLDZ();
99                }
100                default: Inst::FLDCW(Mw);
101            }
102            0x6: decode MODRM_MOD {
103                0x3: decode MODRM_RM {
104                    0x0: f2xm1();
105                    0x1: Inst::FYL2X();
106                    0x2: Inst::FPTAN();
107                    0x3: fpatan();
108                    0x4: fxtract();
109                    0x5: Inst::FPREM1();
110                    0x6: fdecstp();
111                    0x7: fincstp();
112                }
113                default: Inst::FNSTENV(M);
114            }
115            0x7: decode MODRM_MOD {
116                0x3: decode MODRM_RM {
117                    0x0: Inst::FPREM();
118                    0x1: fyl2xp1();
119                    0x2: fsqrt();
120                    0x3: Inst::FSINCOS();
121                    0x4: frndint();
122                    0x5: fscale();
123                    0x6: Inst::FSIN();
124                    0x7: Inst::FCOS();
125                }
126                default: Inst::FNSTCW(Mw);
127            }
128        }
129        //0x2: esc2();
130        0x2: decode MODRM_REG {
131            0x0: decode MODRM_MOD {
132                0x3: fcmovb();
133                default: fiadd();
134            }
135            0x1: decode MODRM_MOD {
136                0x3: fcmove();
137                default: fimul();
138            }
139            0x2: decode MODRM_MOD {
140                0x3: fcmovbe();
141                default: ficom();
142            }
143            0x3: decode MODRM_MOD {
144                0x3: fcmovu();
145                default: ficomp();
146            }
147            0x4: decode MODRM_MOD {
148                0x3: Inst::UD2();
149                default: fisub();
150            }
151            0x5: decode MODRM_MOD {
152                0x3: decode MODRM_RM {
153                    0x1: fucompp();
154                    default: Inst::UD2();
155                }
156                default: fisubr();
157            }
158            0x6: decode MODRM_MOD {
159                0x3: Inst::UD2();
160                default: fidiv();
161            }
162            0x7: decode MODRM_MOD {
163                0x3: Inst::UD2();
164                default: fidivr();
165            }
166        }
167        //0x3: esc3();
168        0x3: decode MODRM_REG {
169            0x0: decode MODRM_MOD {
170                0x3: fcmovnb();
171                default: fild();
172            }
173            0x1: decode MODRM_MOD {
174                0x3: fcmovne();
175                default: fisttp();
176            }
177            0x2: decode MODRM_MOD {
178                0x3: fcmovnbe();
179                default: fist();
180            }
181            0x3: decode MODRM_MOD {
182                0x3: fcmovnu();
183                default: fistp();
184            }
185            0x4: decode MODRM_MOD {
186                0x3: decode MODRM_RM {
187                    0x2: fnclex();
188                    0x3: fninit();
189                    default: Inst::UD2();
190                }
191                default: Inst::UD2();
192            }
193            0x5: decode MODRM_MOD {
194                0x3: fucomi();
195                // 80-bit load
196                default: Inst::FLD80(M);
197            }
198            0x6: decode MODRM_MOD {
199                0x3: fcomi();
200                default: Inst::UD2();
201            }
202            0x7: decode MODRM_MOD {
203                0x3: Inst::UD2();
204                default: Inst::FST80P(M);
205            }
206        }
207        //0x4: esc4();
208        0x4: decode MODRM_REG {
209            0x0: decode MODRM_MOD {
210                0x3: Inst::FADD2(Eq);
211                default: Inst::FADD2(Mq);
212            }
213            0x1: fmul();
214            0x2: decode MODRM_MOD {
215                0x3: Inst::UD2();
216                default: fcom();
217            }
218            0x3: decode MODRM_MOD {
219                0x3: Inst::UD2();
220                default: fcomp();
221            }
222            0x4: decode MODRM_MOD {
223                0x3: fsubr();
224                default: Inst::FSUB2(Mq);
225            }
226            0x5: decode MODRM_MOD {
227                0x3: Inst::FSUB2(Eq);
228                default: fsubr();
229            }
230            0x6: decode MODRM_MOD {
231                0x3: fdivr();
232                default: fdiv();
233            }
234            0x7: decode MODRM_MOD {
235                0x3: fdiv();
236                default: fdivr();
237            }
238        }
239        //0x5: esc5();
240        0x5: decode MODRM_REG {
241            0x0: decode MODRM_MOD {
242                0x3: ffree();
243                // 64-bit load
244                default: Inst::FLD(Mq);
245            }
246            0x1: decode MODRM_MOD {
247                0x3: Inst::UD2();
248                default: fisttp();
249            }
250            0x2: decode MODRM_MOD {
251                0x3: Inst::FST(Eq);
252                default: Inst::FST(Mq);
253            }
254            0x3: decode MODRM_MOD {
255                0x3: Inst::FSTP(Eq);
256                default: Inst::FSTP(Mq);
257            }
258            0x4: decode MODRM_MOD {
259                0x3: fucom();
260                default: frstor();
261            }
262            0x5: decode MODRM_MOD {
263                0x3: fucomp();
264                default: Inst::UD2();
265            }
266            0x6: decode MODRM_MOD {
267                0x3: Inst::UD2();
268                default: fnsave();
269            }
270            0x7: decode MODRM_MOD {
271                0x3: Inst::UD2();
272                default: Inst::FNSTSW(Mw);
273            }
274        }
275        //0x6: esc6();
276        0x6: decode MODRM_REG {
277            0x0: decode MODRM_MOD {
278                0x3: decode MODRM_RM {
279                    0x1: Inst::FADDP();
280                    default: Inst::FADDP(Eq);
281                }
282                default: fiadd();
283            }
284            0x1: decode MODRM_MOD {
285                0x3: fmulp();
286                default: fimul();
287            }
288            0x2: decode MODRM_MOD {
289                0x3: Inst::UD2();
290                default: ficom();
291            }
292            0x3: decode MODRM_MOD {
293                0x3: decode MODRM_RM {
294                    0x1: fcompp();
295                    default: Inst::UD2();
296                }
297                default: ficomp();
298            }
299            0x4: decode MODRM_MOD {
300                0x3: fsubrp();
301                default: fisub();
302            }
303            0x5: decode MODRM_MOD {
304                0x3: decode MODRM_RM {
305                    0x1: Inst::FSUBP();
306                    default: Inst::FSUBP(Eq);
307                }
308                default: fisubr();
309            }
310            0x6: decode MODRM_MOD {
311                0x3: fdivrp();
312                default: fidiv();
313            }
314            0x7: decode MODRM_MOD {
315                0x3: fdivp();
316                default: fidivr();
317            }
318        }
319        //0x7: esc7();
320        0x7: decode MODRM_REG {
321            0x0: decode MODRM_MOD {
322                // The ffreep instruction isn't entirely real. It should work
323                // the same as ffree but then also pop the register stack.
324                0x3: ffreep();
325                default: fild();
326            }
327            0x1: decode MODRM_MOD {
328                0x3: Inst::UD2();
329                default: fisttp();
330            }
331            0x2: decode MODRM_MOD {
332                0x3: Inst::UD2();
333                default: fist();
334            }
335            0x3: decode MODRM_MOD {
336                0x3: Inst::UD2();
337                default: fistp();
338            }
339            0x4: decode MODRM_MOD {
340                0x3: decode MODRM_RM {
341                    0x0: Inst::FNSTSW(rAw);
342                    default: Inst::UD2();
343                }
344                default: fbld();
345            }
346            0x5: decode MODRM_MOD {
347                0x3: fucomip();
348                default: fild();
349            }
350            0x6: decode MODRM_MOD {
351                0x3: fcomip();
352                default: fbstp();
353            }
354            0x7: decode MODRM_MOD {
355                0x3: Inst::UD2();
356                default: fistp();
357            }
358        }
359    }
360}
361