bit_test.py (5326:7e4cef0e528b) bit_test.py (6093:7b88298769c7)
1# Copyright (c) 2008 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution;
11# neither the name of the copyright holders nor the names of its
12# contributors may be used to endorse or promote products derived from
13# this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Gabe Black
28
29# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
30# All rights reserved.
31#
32# Redistribution and use of this software in source and binary forms,
33# with or without modification, are permitted provided that the
34# following conditions are met:
35#
36# The software must be used only for Non-Commercial Use which means any
37# use which is NOT directed to receiving any direct monetary
38# compensation for, or commercial advantage from such use. Illustrative
39# examples of non-commercial use are academic research, personal study,
40# teaching, education and corporate research & development.
41# Illustrative examples of commercial use are distributing products for
42# commercial advantage and providing services using the software for
43# commercial advantage.
44#
45# If you wish to use this software or functionality therein that may be
46# covered by patents for commercial use, please contact:
47# Director of Intellectual Property Licensing
48# Office of Strategy and Technology
49# Hewlett-Packard Company
50# 1501 Page Mill Road
51# Palo Alto, California 94304
52#
53# Redistributions of source code must retain the above copyright notice,
54# this list of conditions and the following disclaimer. Redistributions
55# in binary form must reproduce the above copyright notice, this list of
56# conditions and the following disclaimer in the documentation and/or
57# other materials provided with the distribution. Neither the name of
58# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
59# contributors may be used to endorse or promote products derived from
60# this software without specific prior written permission. No right of
61# sublicense is granted herewith. Derivatives of the software and
62# output created using the software may be prepared, but only for
63# Non-Commercial Uses. Derivatives of the software may be shared with
64# others provided: (i) the others agree to abide by the list of
65# conditions herein which includes the Non-Commercial Use restrictions;
66# and (ii) such Derivatives of the software include the above copyright
67# notice to acknowledge the contribution from this software where
68# applicable, this list of conditions and the disclaimer below.
69#
70# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
71# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
72# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
73# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
74# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
75# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
76# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
77# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
78# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
79# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
80# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81#
82# Authors: Gabe Black
83
84microcode = '''
85def macroop BT_R_I {
86 sexti t0, reg, imm, flags=(CF,)
87};
88
89def macroop BT_M_I {
90 limm t1, imm, dataSize=asz
91 # This fudges just a tiny bit, but it's reasonable to expect the
92 # microcode generation logic to have the log of the various sizes
93 # floating around as well.
94 ld t1, seg, sib, disp
95 sexti t0, t1, imm, flags=(CF,)
96};
97
98def macroop BT_P_I {
99 rdip t7
100 limm t1, imm, dataSize=asz
101 ld t1, seg, riprel, disp, dataSize=asz
102 sexti t0, t1, imm, flags=(CF,)
103};
104
105def macroop BT_R_R {
106 sext t0, reg, regm, flags=(CF,)
107};
108
109def macroop BT_M_R {
110 srai t2, reg, 3, dataSize=asz
111 srai t3, t2, ldsz, dataSize=asz
112 lea t3, flatseg, [dsz, t3, base], dataSize=asz
113 ld t1, seg, [scale, index, t3], disp
114 sext t0, t1, reg, flags=(CF,)
115};
116
117def macroop BT_P_R {
118 rdip t7
119 srai t2, reg, 3, dataSize=asz
120 srai t3, t2, ldsz, dataSize=asz
121 lea t3, flatseg, [ldsz, t3, base], dataSize=asz
122 ld t1, seg, [1, t3, t7], disp
123 sext t0, t1, reg, flags=(CF,)
124};
125
126def macroop BTC_R_I {
127 sexti t0, reg, imm, flags=(CF,)
128 limm t1, 1
129 roli t1, t1, imm
130 xor reg, reg, t1
131};
132
133def macroop BTC_M_I {
134 limm t1, imm, dataSize=asz
135 # This fudges just a tiny bit, but it's reasonable to expect the
136 # microcode generation logic to have the log of the various sizes
137 # floating around as well.
138 limm t4, 1
139 roli t4, t4, imm
140 ldst t1, seg, sib, disp
141 sexti t0, t1, imm, flags=(CF,)
142 xor t1, t1, t4
143 st t1, seg, sib, disp
144};
145
146def macroop BTC_P_I {
147 rdip t7, dataSize=asz
148 limm t1, imm, dataSize=asz
149 limm t4, 1
150 roli t4, t4, imm
151 ldst t1, seg, riprel, disp
152 sexti t0, t1, imm, flags=(CF,)
153 xor t1, t1, t4
154 st t1, seg, riprel, disp
155};
156
157def macroop BTC_R_R {
158 sext t0, reg, regm, flags=(CF,)
159 limm t1, 1
160 rol t1, t1, regm
161 xor reg, reg, t1
162};
163
164def macroop BTC_M_R {
165 srai t2, reg, 3, dataSize=asz
166 srai t3, t2, ldsz, dataSize=asz
167 lea t3, flatseg, [dsz, t3, base], dataSize=asz
168 limm t4, 1
169 rol t4, t4, reg
170 ldst t1, seg, [scale, index, t3], disp
171 sext t0, t1, reg, flags=(CF,)
172 xor t1, t1, t4
173 st t1, seg, [scale, index, t3], disp
174};
175
176def macroop BTC_P_R {
177 rdip t7, dataSize=asz
178 srai t2, reg, 3, dataSize=asz
179 srai t3, t2, ldsz, dataSize=asz
180 lea t3, flatseg, [dsz, t3, base], dataSize=asz
181 limm t4, 1
182 rol t4, t4, reg
183 ldst t1, seg, [1, t2, t7], disp
184 sext t0, t1, reg, flags=(CF,)
185 xor t1, t1, t4
186 st t1, seg, [1, t2, t7], disp
187};
188
189def macroop BTR_R_I {
190 sexti t0, reg, imm, flags=(CF,)
191 limm t1, "(uint64_t(-(2ULL)))"
192 roli t1, t1, imm
193 and reg, reg, t1
194};
195
196def macroop BTR_M_I {
197 limm t1, imm, dataSize=asz
198 limm t4, "(uint64_t(-(2ULL)))"
199 roli t4, t4, imm
200 ldst t1, seg, sib, disp
201 sexti t0, t1, imm, flags=(CF,)
202 and t1, t1, t4
203 st t1, seg, sib, disp
204};
205
206def macroop BTR_P_I {
207 rdip t7, dataSize=asz
208 limm t1, imm, dataSize=asz
209 limm t4, "(uint64_t(-(2ULL)))"
210 roli t4, t4, imm
211 ldst t1, seg, riprel, disp
212 sexti t0, t1, imm, flags=(CF,)
213 and t1, t1, t4
214 st t1, seg, riprel, disp
215};
216
217def macroop BTR_R_R {
218 sext t0, reg, regm, flags=(CF,)
219 limm t1, "(uint64_t(-(2ULL)))"
220 rol t1, t1, regm
221 and reg, reg, t1
222};
223
224def macroop BTR_M_R {
225 srai t2, reg, 3, dataSize=asz
226 srai t3, t2, ldsz, dataSize=asz
227 lea t3, flatseg, [dsz, t3, base], dataSize=asz
228 limm t4, "(uint64_t(-(2ULL)))"
229 rol t4, t4, reg
230 ldst t1, seg, [scale, index, t3], disp
231 sext t0, t1, reg, flags=(CF,)
232 and t1, t1, t4
233 st t1, seg, [scale, index, t3], disp
234};
235
236def macroop BTR_P_R {
237 rdip t7, dataSize=asz
238 srai t2, reg, 3, dataSize=asz
239 srai t3, t2, ldsz, dataSize=asz
240 lea t3, flatseg, [dsz, t3, base], dataSize=asz
241 limm t4, "(uint64_t(-(2ULL)))"
242 rol t4, t4, reg
243 ldst t1, seg, [1, t3, t7], disp
244 sext t0, t1, reg, flags=(CF,)
245 and t1, t1, t4
246 st t1, seg, [1, t3, t7], disp
247};
248
249def macroop BTS_R_I {
250 sexti t0, reg, imm, flags=(CF,)
251 limm t1, 1
252 roli t1, t1, imm
253 or reg, reg, t1
254};
255
256def macroop BTS_M_I {
257 limm t1, imm, dataSize=asz
258 limm t4, 1
259 roli t4, t4, imm
260 ldst t1, seg, sib, disp
261 sexti t0, t1, imm, flags=(CF,)
262 or t1, t1, t4
263 st t1, seg, sib, disp
264};
265
266def macroop BTS_P_I {
267 rdip t7, dataSize=asz
268 limm t1, imm, dataSize=asz
269 limm t4, 1
270 roli t4, t4, imm
271 ldst t1, seg, riprel, disp
272 sexti t0, t1, imm, flags=(CF,)
273 or t1, t1, t4
274 st t1, seg, riprel, disp
275};
276
1# Copyright (c) 2008 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution;
11# neither the name of the copyright holders nor the names of its
12# contributors may be used to endorse or promote products derived from
13# this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Gabe Black
28
29# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
30# All rights reserved.
31#
32# Redistribution and use of this software in source and binary forms,
33# with or without modification, are permitted provided that the
34# following conditions are met:
35#
36# The software must be used only for Non-Commercial Use which means any
37# use which is NOT directed to receiving any direct monetary
38# compensation for, or commercial advantage from such use. Illustrative
39# examples of non-commercial use are academic research, personal study,
40# teaching, education and corporate research & development.
41# Illustrative examples of commercial use are distributing products for
42# commercial advantage and providing services using the software for
43# commercial advantage.
44#
45# If you wish to use this software or functionality therein that may be
46# covered by patents for commercial use, please contact:
47# Director of Intellectual Property Licensing
48# Office of Strategy and Technology
49# Hewlett-Packard Company
50# 1501 Page Mill Road
51# Palo Alto, California 94304
52#
53# Redistributions of source code must retain the above copyright notice,
54# this list of conditions and the following disclaimer. Redistributions
55# in binary form must reproduce the above copyright notice, this list of
56# conditions and the following disclaimer in the documentation and/or
57# other materials provided with the distribution. Neither the name of
58# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
59# contributors may be used to endorse or promote products derived from
60# this software without specific prior written permission. No right of
61# sublicense is granted herewith. Derivatives of the software and
62# output created using the software may be prepared, but only for
63# Non-Commercial Uses. Derivatives of the software may be shared with
64# others provided: (i) the others agree to abide by the list of
65# conditions herein which includes the Non-Commercial Use restrictions;
66# and (ii) such Derivatives of the software include the above copyright
67# notice to acknowledge the contribution from this software where
68# applicable, this list of conditions and the disclaimer below.
69#
70# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
71# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
72# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
73# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
74# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
75# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
76# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
77# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
78# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
79# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
80# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81#
82# Authors: Gabe Black
83
84microcode = '''
85def macroop BT_R_I {
86 sexti t0, reg, imm, flags=(CF,)
87};
88
89def macroop BT_M_I {
90 limm t1, imm, dataSize=asz
91 # This fudges just a tiny bit, but it's reasonable to expect the
92 # microcode generation logic to have the log of the various sizes
93 # floating around as well.
94 ld t1, seg, sib, disp
95 sexti t0, t1, imm, flags=(CF,)
96};
97
98def macroop BT_P_I {
99 rdip t7
100 limm t1, imm, dataSize=asz
101 ld t1, seg, riprel, disp, dataSize=asz
102 sexti t0, t1, imm, flags=(CF,)
103};
104
105def macroop BT_R_R {
106 sext t0, reg, regm, flags=(CF,)
107};
108
109def macroop BT_M_R {
110 srai t2, reg, 3, dataSize=asz
111 srai t3, t2, ldsz, dataSize=asz
112 lea t3, flatseg, [dsz, t3, base], dataSize=asz
113 ld t1, seg, [scale, index, t3], disp
114 sext t0, t1, reg, flags=(CF,)
115};
116
117def macroop BT_P_R {
118 rdip t7
119 srai t2, reg, 3, dataSize=asz
120 srai t3, t2, ldsz, dataSize=asz
121 lea t3, flatseg, [ldsz, t3, base], dataSize=asz
122 ld t1, seg, [1, t3, t7], disp
123 sext t0, t1, reg, flags=(CF,)
124};
125
126def macroop BTC_R_I {
127 sexti t0, reg, imm, flags=(CF,)
128 limm t1, 1
129 roli t1, t1, imm
130 xor reg, reg, t1
131};
132
133def macroop BTC_M_I {
134 limm t1, imm, dataSize=asz
135 # This fudges just a tiny bit, but it's reasonable to expect the
136 # microcode generation logic to have the log of the various sizes
137 # floating around as well.
138 limm t4, 1
139 roli t4, t4, imm
140 ldst t1, seg, sib, disp
141 sexti t0, t1, imm, flags=(CF,)
142 xor t1, t1, t4
143 st t1, seg, sib, disp
144};
145
146def macroop BTC_P_I {
147 rdip t7, dataSize=asz
148 limm t1, imm, dataSize=asz
149 limm t4, 1
150 roli t4, t4, imm
151 ldst t1, seg, riprel, disp
152 sexti t0, t1, imm, flags=(CF,)
153 xor t1, t1, t4
154 st t1, seg, riprel, disp
155};
156
157def macroop BTC_R_R {
158 sext t0, reg, regm, flags=(CF,)
159 limm t1, 1
160 rol t1, t1, regm
161 xor reg, reg, t1
162};
163
164def macroop BTC_M_R {
165 srai t2, reg, 3, dataSize=asz
166 srai t3, t2, ldsz, dataSize=asz
167 lea t3, flatseg, [dsz, t3, base], dataSize=asz
168 limm t4, 1
169 rol t4, t4, reg
170 ldst t1, seg, [scale, index, t3], disp
171 sext t0, t1, reg, flags=(CF,)
172 xor t1, t1, t4
173 st t1, seg, [scale, index, t3], disp
174};
175
176def macroop BTC_P_R {
177 rdip t7, dataSize=asz
178 srai t2, reg, 3, dataSize=asz
179 srai t3, t2, ldsz, dataSize=asz
180 lea t3, flatseg, [dsz, t3, base], dataSize=asz
181 limm t4, 1
182 rol t4, t4, reg
183 ldst t1, seg, [1, t2, t7], disp
184 sext t0, t1, reg, flags=(CF,)
185 xor t1, t1, t4
186 st t1, seg, [1, t2, t7], disp
187};
188
189def macroop BTR_R_I {
190 sexti t0, reg, imm, flags=(CF,)
191 limm t1, "(uint64_t(-(2ULL)))"
192 roli t1, t1, imm
193 and reg, reg, t1
194};
195
196def macroop BTR_M_I {
197 limm t1, imm, dataSize=asz
198 limm t4, "(uint64_t(-(2ULL)))"
199 roli t4, t4, imm
200 ldst t1, seg, sib, disp
201 sexti t0, t1, imm, flags=(CF,)
202 and t1, t1, t4
203 st t1, seg, sib, disp
204};
205
206def macroop BTR_P_I {
207 rdip t7, dataSize=asz
208 limm t1, imm, dataSize=asz
209 limm t4, "(uint64_t(-(2ULL)))"
210 roli t4, t4, imm
211 ldst t1, seg, riprel, disp
212 sexti t0, t1, imm, flags=(CF,)
213 and t1, t1, t4
214 st t1, seg, riprel, disp
215};
216
217def macroop BTR_R_R {
218 sext t0, reg, regm, flags=(CF,)
219 limm t1, "(uint64_t(-(2ULL)))"
220 rol t1, t1, regm
221 and reg, reg, t1
222};
223
224def macroop BTR_M_R {
225 srai t2, reg, 3, dataSize=asz
226 srai t3, t2, ldsz, dataSize=asz
227 lea t3, flatseg, [dsz, t3, base], dataSize=asz
228 limm t4, "(uint64_t(-(2ULL)))"
229 rol t4, t4, reg
230 ldst t1, seg, [scale, index, t3], disp
231 sext t0, t1, reg, flags=(CF,)
232 and t1, t1, t4
233 st t1, seg, [scale, index, t3], disp
234};
235
236def macroop BTR_P_R {
237 rdip t7, dataSize=asz
238 srai t2, reg, 3, dataSize=asz
239 srai t3, t2, ldsz, dataSize=asz
240 lea t3, flatseg, [dsz, t3, base], dataSize=asz
241 limm t4, "(uint64_t(-(2ULL)))"
242 rol t4, t4, reg
243 ldst t1, seg, [1, t3, t7], disp
244 sext t0, t1, reg, flags=(CF,)
245 and t1, t1, t4
246 st t1, seg, [1, t3, t7], disp
247};
248
249def macroop BTS_R_I {
250 sexti t0, reg, imm, flags=(CF,)
251 limm t1, 1
252 roli t1, t1, imm
253 or reg, reg, t1
254};
255
256def macroop BTS_M_I {
257 limm t1, imm, dataSize=asz
258 limm t4, 1
259 roli t4, t4, imm
260 ldst t1, seg, sib, disp
261 sexti t0, t1, imm, flags=(CF,)
262 or t1, t1, t4
263 st t1, seg, sib, disp
264};
265
266def macroop BTS_P_I {
267 rdip t7, dataSize=asz
268 limm t1, imm, dataSize=asz
269 limm t4, 1
270 roli t4, t4, imm
271 ldst t1, seg, riprel, disp
272 sexti t0, t1, imm, flags=(CF,)
273 or t1, t1, t4
274 st t1, seg, riprel, disp
275};
276
277def macroop BTS_LOCKED_M_I {
278 limm t1, imm, dataSize=asz
279 limm t4, 1
280 roli t4, t4, imm
281 ldstl t1, seg, sib, disp
282 sexti t0, t1, imm, flags=(CF,)
283 or t1, t1, t4
284 stul t1, seg, sib, disp
285};
286
287def macroop BTS_LOCKED_P_I {
288 rdip t7, dataSize=asz
289 limm t1, imm, dataSize=asz
290 limm t4, 1
291 roli t4, t4, imm
292 ldstl t1, seg, riprel, disp
293 sexti t0, t1, imm, flags=(CF,)
294 or t1, t1, t4
295 stul t1, seg, riprel, disp
296};
297
277def macroop BTS_R_R {
278 sext t0, reg, regm, flags=(CF,)
279 limm t1, 1
280 rol t1, t1, regm
281 or reg, reg, t1
282};
283
284def macroop BTS_M_R {
285 srai t2, reg, 3, dataSize=asz
286 srai t3, t2, ldsz, dataSize=asz
287 lea t3, flatseg, [dsz, t3, base], dataSize=asz
288 limm t4, 1
289 rol t4, t4, reg
290 ldst t1, seg, [scale, index, t3], disp
291 sext t0, t1, reg, flags=(CF,)
292 or t1, t1, t4
293 st t1, seg, [scale, index, t3], disp
294};
295
296def macroop BTS_P_R {
297 rdip t7, dataSize=asz
298 srai t2, reg, 3, dataSize=asz
299 srai t3, t2, ldsz, dataSize=asz
300 lea t3, flatseg, [dsz, t3, base], dataSize=asz
301 limm t4, 1
302 rol t4, t4, reg
303 ldst t1, seg, [1, t3, t7], disp
304 sext t0, t1, reg, flags=(CF,)
305 or t1, t1, t4
306 st t1, seg, [1, t3, t7], disp
307};
298def macroop BTS_R_R {
299 sext t0, reg, regm, flags=(CF,)
300 limm t1, 1
301 rol t1, t1, regm
302 or reg, reg, t1
303};
304
305def macroop BTS_M_R {
306 srai t2, reg, 3, dataSize=asz
307 srai t3, t2, ldsz, dataSize=asz
308 lea t3, flatseg, [dsz, t3, base], dataSize=asz
309 limm t4, 1
310 rol t4, t4, reg
311 ldst t1, seg, [scale, index, t3], disp
312 sext t0, t1, reg, flags=(CF,)
313 or t1, t1, t4
314 st t1, seg, [scale, index, t3], disp
315};
316
317def macroop BTS_P_R {
318 rdip t7, dataSize=asz
319 srai t2, reg, 3, dataSize=asz
320 srai t3, t2, ldsz, dataSize=asz
321 lea t3, flatseg, [dsz, t3, base], dataSize=asz
322 limm t4, 1
323 rol t4, t4, reg
324 ldst t1, seg, [1, t3, t7], disp
325 sext t0, t1, reg, flags=(CF,)
326 or t1, t1, t4
327 st t1, seg, [1, t3, t7], disp
328};
329
330def macroop BTS_LOCKED_M_R {
331 srai t2, reg, 3, dataSize=asz
332 srai t3, t2, ldsz, dataSize=asz
333 lea t3, flatseg, [dsz, t3, base], dataSize=asz
334 limm t4, 1
335 rol t4, t4, reg
336 ldstl t1, seg, [scale, index, t3], disp
337 sext t0, t1, reg, flags=(CF,)
338 or t1, t1, t4
339 stul t1, seg, [scale, index, t3], disp
340};
341
342def macroop BTS_LOCKED_P_R {
343 rdip t7, dataSize=asz
344 srai t2, reg, 3, dataSize=asz
345 srai t3, t2, ldsz, dataSize=asz
346 lea t3, flatseg, [dsz, t3, base], dataSize=asz
347 limm t4, 1
348 rol t4, t4, reg
349 ldstl t1, seg, [1, t3, t7], disp
350 sext t0, t1, reg, flags=(CF,)
351 or t1, t1, t4
352 stul t1, seg, [1, t3, t7], disp
353};
308'''
354'''