conditional_move.py revision 5081:2ccce8600a9d
1# Copyright (c) 2007 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use of this software in source and binary forms,
5# with or without modification, are permitted provided that the
6# following conditions are met:
7#
8# The software must be used only for Non-Commercial Use which means any
9# use which is NOT directed to receiving any direct monetary
10# compensation for, or commercial advantage from such use.  Illustrative
11# examples of non-commercial use are academic research, personal study,
12# teaching, education and corporate research & development.
13# Illustrative examples of commercial use are distributing products for
14# commercial advantage and providing services using the software for
15# commercial advantage.
16#
17# If you wish to use this software or functionality therein that may be
18# covered by patents for commercial use, please contact:
19#     Director of Intellectual Property Licensing
20#     Office of Strategy and Technology
21#     Hewlett-Packard Company
22#     1501 Page Mill Road
23#     Palo Alto, California  94304
24#
25# Redistributions of source code must retain the above copyright notice,
26# this list of conditions and the following disclaimer.  Redistributions
27# in binary form must reproduce the above copyright notice, this list of
28# conditions and the following disclaimer in the documentation and/or
29# other materials provided with the distribution.  Neither the name of
30# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
31# contributors may be used to endorse or promote products derived from
32# this software without specific prior written permission.  No right of
33# sublicense is granted herewith.  Derivatives of the software and
34# output created using the software may be prepared, but only for
35# Non-Commercial Uses.  Derivatives of the software may be shared with
36# others provided: (i) the others agree to abide by the list of
37# conditions herein which includes the Non-Commercial Use restrictions;
38# and (ii) such Derivatives of the software include the above copyright
39# notice to acknowledge the contribution from this software where
40# applicable, this list of conditions and the disclaimer below.
41#
42# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53#
54# Authors: Gabe Black
55
56microcode = '''
57def macroop CMOVZ_R_R
58{
59    mov reg, reg, regm, flags=(CZF,)
60};
61
62def macroop CMOVZ_R_M
63{
64    ld t1, seg, sib, disp
65    mov reg, reg, t1, flags=(CZF,)
66};
67
68def macroop CMOVZ_R_P
69{
70    rdip t7
71    ld t1, seg, riprel, disp
72    mov reg, reg, t1, flags=(CZF,)
73};
74
75def macroop CMOVNZ_R_R
76{
77    mov reg, reg, regm, flags=(nCZF,)
78};
79
80def macroop CMOVNZ_R_M
81{
82    ld t1, seg, sib, disp
83    mov reg, reg, t1, flags=(nCZF,)
84};
85
86def macroop CMOVNZ_R_P
87{
88    rdip t7
89    ld t1, seg, riprel, disp
90    mov reg, reg, t1, flags=(nCZF,)
91};
92
93def macroop CMOVB_R_R
94{
95    mov reg, reg, regm, flags=(CCF,)
96};
97
98def macroop CMOVB_R_M
99{
100    ld t1, seg, sib, disp
101    mov reg, reg, t1, flags=(CCF,)
102};
103
104def macroop CMOVB_R_P
105{
106    rdip t7
107    ld t1, seg, riprel, disp
108    mov reg, reg, t1, flags=(CCF,)
109};
110
111def macroop CMOVNB_R_R
112{
113    mov reg, reg, regm, flags=(nCCF,)
114};
115
116def macroop CMOVNB_R_M
117{
118    ld t1, seg, sib, disp
119    mov reg, reg, t1, flags=(nCCF,)
120};
121
122def macroop CMOVNB_R_P
123{
124    rdip t7
125    ld t1, seg, riprel, disp
126    mov reg, reg, t1, flags=(nCCF,)
127};
128
129def macroop CMOVBE_R_R
130{
131    mov reg, reg, regm, flags=(CCvZF,)
132};
133
134def macroop CMOVBE_R_M
135{
136    ld t1, seg, sib, disp
137    mov reg, reg, t1, flags=(CCvZF,)
138};
139
140def macroop CMOVBE_R_P
141{
142    rdip t7
143    ld t1, seg, riprel, disp
144    mov reg, reg, t1, flags=(CCvZF,)
145};
146
147def macroop CMOVNBE_R_R
148{
149    mov reg, reg, regm, flags=(nCCvZF,)
150};
151
152def macroop CMOVNBE_R_M
153{
154    ld t1, seg, sib, disp
155    mov reg, reg, t1, flags=(nCCvZF,)
156};
157
158def macroop CMOVNBE_R_P
159{
160    rdip t7
161    ld t1, seg, riprel, disp
162    mov reg, reg, t1, flags=(nCCvZF,)
163};
164
165def macroop CMOVS_R_R
166{
167    mov reg, reg, regm, flags=(CSF,)
168};
169
170def macroop CMOVS_R_M
171{
172    ld t1, seg, sib, disp
173    mov reg, reg, t1, flags=(CSF,)
174};
175
176def macroop CMOVS_R_P
177{
178    rdip t7
179    ld t1, seg, riprel, disp
180    mov reg, reg, t1, flags=(CSF,)
181};
182
183def macroop CMOVNS_R_R
184{
185    mov reg, reg, regm, flags=(nCSF,)
186};
187
188def macroop CMOVNS_R_M
189{
190    ld t1, seg, sib, disp
191    mov reg, reg, t1, flags=(nCSF,)
192};
193
194def macroop CMOVNS_R_P
195{
196    rdip t7
197    ld t1, seg, riprel, disp
198    mov reg, reg, t1, flags=(nCSF,)
199};
200
201def macroop CMOVP_R_R
202{
203    mov reg, reg, regm, flags=(CPF,)
204};
205
206def macroop CMOVP_R_M
207{
208    ld t1, seg, sib, disp
209    mov reg, reg, t1, flags=(CPF,)
210};
211
212def macroop CMOVP_R_P
213{
214    rdip t7
215    ld t1, seg, riprel, disp
216    mov reg, reg, t1, flags=(CPF,)
217};
218
219def macroop CMOVNP_R_R
220{
221    mov reg, reg, regm, flags=(nCPF,)
222};
223
224def macroop CMOVNP_R_M
225{
226    ld t1, seg, sib, disp
227    mov reg, reg, regm, flags=(nCPF,)
228};
229
230def macroop CMOVNP_R_P
231{
232    rdip t7
233    ld t1, seg, riprel, disp
234    mov reg, reg, regm, flags=(nCPF,)
235};
236
237def macroop CMOVL_R_R
238{
239    mov reg, reg, regm, flags=(CSxOF,)
240};
241
242def macroop CMOVL_R_M
243{
244    ld t1, seg, sib, disp
245    mov reg, reg, t1, flags=(CSxOF,)
246};
247
248def macroop CMOVL_R_P
249{
250    rdip t7
251    ld t1, seg, riprel, disp
252    mov reg, reg, t1, flags=(CSxOF,)
253};
254
255def macroop CMOVNL_R_R
256{
257    mov reg, reg, regm, flags=(nCSxOF,)
258};
259
260def macroop CMOVNL_R_M
261{
262    ld t1, seg, sib, disp
263    mov reg, reg, t1, flags=(nCSxOF,)
264};
265
266def macroop CMOVNL_R_P
267{
268    rdip t7
269    ld t1, seg, riprel, disp
270    mov reg, reg, t1, flags=(nCSxOF,)
271};
272
273def macroop CMOVLE_R_R
274{
275    mov reg, reg, regm, flags=(CSxOvZF,)
276};
277
278def macroop CMOVLE_R_M
279{
280    ld t1, seg, sib, disp
281    mov reg, reg, t1, flags=(CSxOvZF,)
282};
283
284def macroop CMOVLE_R_P
285{
286    rdip t7
287    ld t1, seg, riprel, disp
288    mov reg, reg, t1, flags=(CSxOvZF,)
289};
290
291def macroop CMOVNLE_R_R
292{
293    mov reg, reg, regm, flags=(nCSxOvZF,)
294};
295
296def macroop CMOVNLE_R_M
297{
298    ld t1, seg, sib, disp
299    mov reg, reg, t1, flags=(nCSxOvZF,)
300};
301
302def macroop CMOVNLE_R_P
303{
304    rdip t7
305    ld t1, seg, riprel, disp
306    mov reg, reg, t1, flags=(nCSxOvZF,)
307};
308
309def macroop CMOVO_R_R
310{
311    mov reg, reg, regm, flags=(COF,)
312};
313
314def macroop CMOVO_R_M
315{
316    ld t1, seg, sib, disp
317    mov reg, reg, t1, flags=(COF,)
318};
319
320def macroop CMOVO_R_P
321{
322    rdip t7
323    ld t1, seg, riprel, disp
324    mov reg, reg, t1, flags=(COF,)
325};
326
327def macroop CMOVNO_R_R
328{
329    mov reg, reg, regm, flags=(nCOF,)
330};
331
332def macroop CMOVNO_R_M
333{
334    ld t1, seg, sib, disp
335    mov reg, reg, t1, flags=(nCOF,)
336};
337
338def macroop CMOVNO_R_P
339{
340    rdip t7
341    ld t1, seg, riprel, disp
342    mov reg, reg, t1, flags=(nCOF,)
343};
344'''
345