set_byte_on_condition.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 SETZ_R
58{
59    movi reg, reg, 1, flags=(CZF,)
60    movi reg, reg, 0, flags=(nCZF,)
61};
62
63def macroop SETZ_M
64{
65    movi t1, t1, 1, flags=(CZF,)
66    movi t1, t1, 0, flags=(nCZF,)
67    st t1, seg, sib, disp
68};
69
70def macroop SETZ_P
71{
72    rdip t7
73    movi t1, t1, 1, flags=(CZF,)
74    movi t1, t1, 0, flags=(nCZF,)
75    st t1, seg, riprel, disp
76};
77
78def macroop SETNZ_R
79{
80    movi reg, reg, 1, flags=(nCZF,)
81    movi reg, reg, 0, flags=(CZF,)
82};
83
84def macroop SETNZ_M
85{
86    movi t1, t1, 1, flags=(nCZF,)
87    movi t1, t1, 0, flags=(CZF,)
88    st t1, seg, sib, disp
89};
90
91def macroop SETNZ_P
92{
93    rdip t7
94    movi t1, t1, 1, flags=(nCZF,)
95    movi t1, t1, 0, flags=(CZF,)
96    st t1, seg, riprel, disp
97};
98
99def macroop SETB_R
100{
101    movi reg, reg, 1, flags=(CCF,)
102    movi reg, reg, 0, flags=(nCCF,)
103};
104
105def macroop SETB_M
106{
107    movi t1, t1, 1, flags=(CCF,)
108    movi t1, t1, 0, flags=(nCCF,)
109    st t1, seg, sib, disp
110};
111
112def macroop SETB_P
113{
114    rdip t7
115    movi t1, t1, 1, flags=(CCF,)
116    movi t1, t1, 0, flags=(nCCF,)
117    st t1, seg, riprel, disp
118};
119
120def macroop SETNB_R
121{
122    movi reg, reg, 1, flags=(nCCF,)
123    movi reg, reg, 0, flags=(CCF,)
124};
125
126def macroop SETNB_M
127{
128    movi t1, t1, 1, flags=(nCCF,)
129    movi t1, t1, 0, flags=(CCF,)
130    st t1, seg, sib, disp
131};
132
133def macroop SETNB_P
134{
135    rdip t7
136    movi t1, t1, 1, flags=(nCCF,)
137    movi t1, t1, 0, flags=(CCF,)
138    st t1, seg, riprel, disp
139};
140
141def macroop SETBE_R
142{
143    movi reg, reg, 1, flags=(CCvZF,)
144    movi reg, reg, 0, flags=(nCCvZF,)
145};
146
147def macroop SETBE_M
148{
149    movi t1, t1, 1, flags=(CCvZF,)
150    movi t1, t1, 0, flags=(nCCvZF,)
151    st t1, seg, sib, disp
152};
153
154def macroop SETBE_P
155{
156    rdip t7
157    movi t1, t1, 1, flags=(CCvZF,)
158    movi t1, t1, 0, flags=(nCCvZF,)
159    st t1, seg, riprel, disp
160};
161
162def macroop SETNBE_R
163{
164    movi reg, reg, 1, flags=(nCCvZF,)
165    movi reg, reg, 0, flags=(CCvZF,)
166};
167
168def macroop SETNBE_M
169{
170    movi t1, t1, 1, flags=(nCCvZF,)
171    movi t1, t1, 0, flags=(CCvZF,)
172    st t1, seg, sib, disp
173};
174
175def macroop SETNBE_P
176{
177    rdip t7
178    movi t1, t1, 1, flags=(nCCvZF,)
179    movi t1, t1, 0, flags=(CCvZF,)
180    st t1, seg, riprel, disp
181};
182
183def macroop SETS_R
184{
185    movi reg, reg, 1, flags=(CSF,)
186    movi reg, reg, 0, flags=(nCSF,)
187};
188
189def macroop SETS_M
190{
191    movi t1, t1, 1, flags=(CSF,)
192    movi t1, t1, 0, flags=(nCSF,)
193    st t1, seg, sib, disp
194};
195
196def macroop SETS_P
197{
198    rdip t7
199    movi t1, t1, 1, flags=(CSF,)
200    movi t1, t1, 0, flags=(nCSF,)
201    st t1, seg, riprel, disp
202};
203
204def macroop SETNS_R
205{
206    movi reg, reg, 1, flags=(nCSF,)
207    movi reg, reg, 0, flags=(CSF,)
208};
209
210def macroop SETNS_M
211{
212    movi t1, t1, 1, flags=(nCSF,)
213    movi t1, t1, 0, flags=(CSF,)
214    st t1, seg, sib, disp
215};
216
217def macroop SETNS_P
218{
219    rdip t7
220    movi t1, t1, 1, flags=(nCSF,)
221    movi t1, t1, 0, flags=(CSF,)
222    st t1, seg, riprel, disp
223};
224
225def macroop SETP_R
226{
227    movi reg, reg, 1, flags=(CPF,)
228    movi reg, reg, 0, flags=(nCPF,)
229};
230
231def macroop SETP_M
232{
233    movi t1, t1, 1, flags=(CPF,)
234    movi t1, t1, 0, flags=(nCPF,)
235    st t1, seg, sib, disp
236};
237
238def macroop SETP_P
239{
240    rdip t7
241    movi t1, t1, 1, flags=(CPF,)
242    movi t1, t1, 0, flags=(nCPF,)
243    st t1, seg, riprel, disp
244};
245
246def macroop SETNP_R
247{
248    movi reg, reg, 1, flags=(nCPF,)
249    movi reg, reg, 0, flags=(CPF,)
250};
251
252def macroop SETNP_M
253{
254    movi t1, t1, 1, flags=(nCPF,)
255    movi t1, t1, 0, flags=(CPF,)
256    st t1, seg, sib, disp
257};
258
259def macroop SETNP_P
260{
261    rdip t7
262    movi t1, t1, 1, flags=(nCPF,)
263    movi t1, t1, 0, flags=(CPF,)
264    st t1, seg, riprel, disp
265};
266
267def macroop SETL_R
268{
269    movi reg, reg, 1, flags=(CSxOF,)
270    movi reg, reg, 0, flags=(nCSxOF,)
271};
272
273def macroop SETL_M
274{
275    movi t1, t1, 1, flags=(CSxOF,)
276    movi t1, t1, 0, flags=(nCSxOF,)
277    st t1, seg, sib, disp
278};
279
280def macroop SETL_P
281{
282    rdip t7
283    movi t1, t1, 1, flags=(CSxOF,)
284    movi t1, t1, 0, flags=(nCSxOF,)
285    st t1, seg, riprel, disp
286};
287
288def macroop SETNL_R
289{
290    movi reg, reg, 1, flags=(nCSxOF,)
291    movi reg, reg, 0, flags=(CSxOF,)
292};
293
294def macroop SETNL_M
295{
296    movi t1, t1, 1, flags=(nCSxOF,)
297    movi t1, t1, 0, flags=(CSxOF,)
298    st t1, seg, sib, disp
299};
300
301def macroop SETNL_P
302{
303    rdip t7
304    movi t1, t1, 1, flags=(nCSxOF,)
305    movi t1, t1, 0, flags=(CSxOF,)
306    st t1, seg, riprel, disp
307};
308
309def macroop SETLE_R
310{
311    movi reg, reg, 1, flags=(CSxOvZF,)
312    movi reg, reg, 0, flags=(nCSxOvZF,)
313};
314
315def macroop SETLE_M
316{
317    movi t1, t1, 1, flags=(CSxOvZF,)
318    movi t1, t1, 0, flags=(nCSxOvZF,)
319    st t1, seg, sib, disp
320};
321
322def macroop SETLE_P
323{
324    rdip t7
325    movi t1, t1, 1, flags=(CSxOvZF,)
326    movi t1, t1, 0, flags=(nCSxOvZF,)
327    st t1, seg, riprel, disp
328};
329
330def macroop SETNLE_R
331{
332    movi reg, reg, 1, flags=(nCSxOvZF,)
333    movi reg, reg, 0, flags=(CSxOvZF,)
334};
335
336def macroop SETNLE_M
337{
338    movi t1, t1, 1, flags=(nCSxOvZF,)
339    movi t1, t1, 0, flags=(CSxOvZF,)
340    st t1, seg, sib, disp
341};
342
343def macroop SETNLE_P
344{
345    rdip t7
346    movi t1, t1, 1, flags=(nCSxOvZF,)
347    movi t1, t1, 0, flags=(CSxOvZF,)
348    st t1, seg, riprel, disp
349};
350
351def macroop SETO_R
352{
353    movi reg, reg, 1, flags=(COF,)
354    movi reg, reg, 0, flags=(nCOF,)
355};
356
357def macroop SETO_M
358{
359    movi t1, t1, 1, flags=(COF,)
360    movi t1, t1, 0, flags=(nCOF,)
361    st t1, seg, sib, disp
362};
363
364def macroop SETO_P
365{
366    rdip t7
367    movi t1, t1, 1, flags=(COF,)
368    movi t1, t1, 0, flags=(nCOF,)
369    st t1, seg, riprel, disp
370};
371
372def macroop SETNO_R
373{
374    movi reg, reg, 1, flags=(nCOF,)
375    movi reg, reg, 0, flags=(COF,)
376};
377
378def macroop SETNO_M
379{
380    movi t1, t1, 1, flags=(nCOF,)
381    movi t1, t1, 0, flags=(COF,)
382    st t1, seg, sib, disp
383};
384
385def macroop SETNO_P
386{
387    rdip t7
388    movi t1, t1, 1, flags=(nCOF,)
389    movi t1, t1, 0, flags=(COF,)
390    st t1, seg, riprel, disp
391};
392'''
393