1# Copyright (c) 2007 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder.  You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
12#
13# Redistribution and use in source and binary forms, with or without
14# modification, are permitted provided that the following conditions are
15# met: redistributions of source code must retain the above copyright
16# notice, this list of conditions and the following disclaimer;
17# redistributions in binary form must reproduce the above copyright
18# notice, this list of conditions and the following disclaimer in the
19# documentation and/or other materials provided with the distribution;
20# neither the name of the copyright holders nor the names of its
21# contributors may be used to endorse or promote products derived from
22# this software without specific prior written permission.
23#
24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35#
36# Authors: Gabe Black
37
38microcode = '''
39def macroop CMOVZ_R_R
40{
41    mov reg, reg, reg, flags=(nCZF,)
42    mov reg, reg, regm, flags=(CZF,)
43};
44
45def macroop CMOVZ_R_M
46{
47    ld t1, seg, sib, disp
48    mov reg, reg, reg, flags=(nCZF,)
49    mov reg, reg, t1, flags=(CZF,)
50};
51
52def macroop CMOVZ_R_P
53{
54    rdip t7
55    ld t1, seg, riprel, disp
56    mov reg, reg, reg, flags=(nCZF,)
57    mov reg, reg, t1, flags=(CZF,)
58};
59
60def macroop CMOVNZ_R_R
61{
62    mov reg, reg, reg, flags=(CZF,)
63    mov reg, reg, regm, flags=(nCZF,)
64};
65
66def macroop CMOVNZ_R_M
67{
68    ld t1, seg, sib, disp
69    mov reg, reg, reg, flags=(CZF,)
70    mov reg, reg, t1, flags=(nCZF,)
71};
72
73def macroop CMOVNZ_R_P
74{
75    rdip t7
76    ld t1, seg, riprel, disp
77    mov reg, reg, reg, flags=(CZF,)
78    mov reg, reg, t1, flags=(nCZF,)
79};
80
81def macroop CMOVB_R_R
82{
83    mov reg, reg, reg, flags=(nCCF,)
84    mov reg, reg, regm, flags=(CCF,)
85};
86
87def macroop CMOVB_R_M
88{
89    ld t1, seg, sib, disp
90    mov reg, reg, reg, flags=(nCCF,)
91    mov reg, reg, t1, flags=(CCF,)
92};
93
94def macroop CMOVB_R_P
95{
96    rdip t7
97    ld t1, seg, riprel, disp
98    mov reg, reg, reg, flags=(nCCF,)
99    mov reg, reg, t1, flags=(CCF,)
100};
101
102def macroop CMOVNB_R_R
103{
104    mov reg, reg, reg, flags=(CCF,)
105    mov reg, reg, regm, flags=(nCCF,)
106};
107
108def macroop CMOVNB_R_M
109{
110    ld t1, seg, sib, disp
111    mov reg, reg, reg, flags=(CCF,)
112    mov reg, reg, t1, flags=(nCCF,)
113};
114
115def macroop CMOVNB_R_P
116{
117    rdip t7
118    ld t1, seg, riprel, disp
119    mov reg, reg, reg, flags=(CCF,)
120    mov reg, reg, t1, flags=(nCCF,)
121};
122
123def macroop CMOVBE_R_R
124{
125    mov reg, reg, reg, flags=(nCCvZF,)
126    mov reg, reg, regm, flags=(CCvZF,)
127};
128
129def macroop CMOVBE_R_M
130{
131    ld t1, seg, sib, disp
132    mov reg, reg, reg, flags=(nCCvZF,)
133    mov reg, reg, t1, flags=(CCvZF,)
134};
135
136def macroop CMOVBE_R_P
137{
138    rdip t7
139    ld t1, seg, riprel, disp
140    mov reg, reg, reg, flags=(nCCvZF,)
141    mov reg, reg, t1, flags=(CCvZF,)
142};
143
144def macroop CMOVNBE_R_R
145{
146    mov reg, reg, reg, flags=(CCvZF,)
147    mov reg, reg, regm, flags=(nCCvZF,)
148};
149
150def macroop CMOVNBE_R_M
151{
152    ld t1, seg, sib, disp
153    mov reg, reg, reg, flags=(CCvZF,)
154    mov reg, reg, t1, flags=(nCCvZF,)
155};
156
157def macroop CMOVNBE_R_P
158{
159    rdip t7
160    ld t1, seg, riprel, disp
161    mov reg, reg, reg, flags=(CCvZF,)
162    mov reg, reg, t1, flags=(nCCvZF,)
163};
164
165def macroop CMOVS_R_R
166{
167    mov reg, reg, reg, flags=(nCSF,)
168    mov reg, reg, regm, flags=(CSF,)
169};
170
171def macroop CMOVS_R_M
172{
173    ld t1, seg, sib, disp
174    mov reg, reg, reg, flags=(nCSF,)
175    mov reg, reg, t1, flags=(CSF,)
176};
177
178def macroop CMOVS_R_P
179{
180    rdip t7
181    ld t1, seg, riprel, disp
182    mov reg, reg, reg, flags=(nCSF,)
183    mov reg, reg, t1, flags=(CSF,)
184};
185
186def macroop CMOVNS_R_R
187{
188    mov reg, reg, reg, flags=(CSF,)
189    mov reg, reg, regm, flags=(nCSF,)
190};
191
192def macroop CMOVNS_R_M
193{
194    ld t1, seg, sib, disp
195    mov reg, reg, reg, flags=(CSF,)
196    mov reg, reg, t1, flags=(nCSF,)
197};
198
199def macroop CMOVNS_R_P
200{
201    rdip t7
202    ld t1, seg, riprel, disp
203    mov reg, reg, reg, flags=(CSF,)
204    mov reg, reg, t1, flags=(nCSF,)
205};
206
207def macroop CMOVP_R_R
208{
209    mov reg, reg, reg, flags=(nCPF,)
210    mov reg, reg, regm, flags=(CPF,)
211};
212
213def macroop CMOVP_R_M
214{
215    ld t1, seg, sib, disp
216    mov reg, reg, reg, flags=(nCPF,)
217    mov reg, reg, t1, flags=(CPF,)
218};
219
220def macroop CMOVP_R_P
221{
222    rdip t7
223    ld t1, seg, riprel, disp
224    mov reg, reg, reg, flags=(nCPF,)
225    mov reg, reg, t1, flags=(CPF,)
226};
227
228def macroop CMOVNP_R_R
229{
230    mov reg, reg, reg, flags=(CPF,)
231    mov reg, reg, regm, flags=(nCPF,)
232};
233
234def macroop CMOVNP_R_M
235{
236    ld t1, seg, sib, disp
237    mov reg, reg, reg, flags=(CPF,)
238    mov reg, reg, t1, flags=(nCPF,)
239};
240
241def macroop CMOVNP_R_P
242{
243    rdip t7
244    ld t1, seg, riprel, disp
245    mov reg, reg, reg, flags=(CPF,)
246    mov reg, reg, t1, flags=(nCPF,)
247};
248
249def macroop CMOVL_R_R
250{
251    mov reg, reg, reg, flags=(nCSxOF,)
252    mov reg, reg, regm, flags=(CSxOF,)
253};
254
255def macroop CMOVL_R_M
256{
257    ld t1, seg, sib, disp
258    mov reg, reg, reg, flags=(nCSxOF,)
259    mov reg, reg, t1, flags=(CSxOF,)
260};
261
262def macroop CMOVL_R_P
263{
264    rdip t7
265    ld t1, seg, riprel, disp
266    mov reg, reg, reg, flags=(nCSxOF,)
267    mov reg, reg, t1, flags=(CSxOF,)
268};
269
270def macroop CMOVNL_R_R
271{
272    mov reg, reg, reg, flags=(CSxOF,)
273    mov reg, reg, regm, flags=(nCSxOF,)
274};
275
276def macroop CMOVNL_R_M
277{
278    ld t1, seg, sib, disp
279    mov reg, reg, reg, flags=(CSxOF,)
280    mov reg, reg, t1, flags=(nCSxOF,)
281};
282
283def macroop CMOVNL_R_P
284{
285    rdip t7
286    ld t1, seg, riprel, disp
287    mov reg, reg, reg, flags=(CSxOF,)
288    mov reg, reg, t1, flags=(nCSxOF,)
289};
290
291def macroop CMOVLE_R_R
292{
293    mov reg, reg, reg, flags=(nCSxOvZF,)
294    mov reg, reg, regm, flags=(CSxOvZF,)
295};
296
297def macroop CMOVLE_R_M
298{
299    ld t1, seg, sib, disp
300    mov reg, reg, reg, flags=(nCSxOvZF,)
301    mov reg, reg, t1, flags=(CSxOvZF,)
302};
303
304def macroop CMOVLE_R_P
305{
306    rdip t7
307    ld t1, seg, riprel, disp
308    mov reg, reg, reg, flags=(nCSxOvZF,)
309    mov reg, reg, t1, flags=(CSxOvZF,)
310};
311
312def macroop CMOVNLE_R_R
313{
314    mov reg, reg, reg, flags=(CSxOvZF,)
315    mov reg, reg, regm, flags=(nCSxOvZF,)
316};
317
318def macroop CMOVNLE_R_M
319{
320    ld t1, seg, sib, disp
321    mov reg, reg, reg, flags=(CSxOvZF,)
322    mov reg, reg, t1, flags=(nCSxOvZF,)
323};
324
325def macroop CMOVNLE_R_P
326{
327    rdip t7
328    ld t1, seg, riprel, disp
329    mov reg, reg, reg, flags=(CSxOvZF,)
330    mov reg, reg, t1, flags=(nCSxOvZF,)
331};
332
333def macroop CMOVO_R_R
334{
335    mov reg, reg, reg, flags=(nCOF,)
336    mov reg, reg, regm, flags=(COF,)
337};
338
339def macroop CMOVO_R_M
340{
341    ld t1, seg, sib, disp
342    mov reg, reg, reg, flags=(nCOF,)
343    mov reg, reg, t1, flags=(COF,)
344};
345
346def macroop CMOVO_R_P
347{
348    rdip t7
349    ld t1, seg, riprel, disp
350    mov reg, reg, reg, flags=(nCOF,)
351    mov reg, reg, t1, flags=(COF,)
352};
353
354def macroop CMOVNO_R_R
355{
356    mov reg, reg, reg, flags=(COF,)
357    mov reg, reg, regm, flags=(nCOF,)
358};
359
360def macroop CMOVNO_R_M
361{
362    ld t1, seg, sib, disp
363    mov reg, reg, reg, flags=(COF,)
364    mov reg, reg, t1, flags=(nCOF,)
365};
366
367def macroop CMOVNO_R_P
368{
369    rdip t7
370    ld t1, seg, riprel, disp
371    mov reg, reg, reg, flags=(COF,)
372    mov reg, reg, t1, flags=(nCOF,)
373};
374'''
375