bit_test.py (5305:8b379ad9406d) bit_test.py (5306:79cedb731af5)
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

--- 45 unchanged lines hidden (view full) ---

54# Authors: Gabe Black
55
56microcode = '''
57def macroop BT_R_I {
58 sexti t0, reg, imm, flags=(CF,)
59};
60
61def macroop BT_M_I {
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

--- 45 unchanged lines hidden (view full) ---

54# Authors: Gabe Black
55
56microcode = '''
57def macroop BT_R_I {
58 sexti t0, reg, imm, flags=(CF,)
59};
60
61def macroop BT_M_I {
62 limm t1, imm
62 limm t1, imm, dataSize=asz
63 # This fudges just a tiny bit, but it's reasonable to expect the
64 # microcode generation logic to have the log of the various sizes
65 # floating around as well.
63 # This fudges just a tiny bit, but it's reasonable to expect the
64 # microcode generation logic to have the log of the various sizes
65 # floating around as well.
66 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
67 add t2, t2, base
66 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
67 dataSize=asz
68 add t2, t2, base, dataSize=asz
68 ld t1, seg, [scale, index, t2], disp
69 sexti t0, t1, imm, flags=(CF,)
70};
71
72def macroop BT_P_I {
73 rdip t7
69 ld t1, seg, [scale, index, t2], disp
70 sexti t0, t1, imm, flags=(CF,)
71};
72
73def macroop BT_P_I {
74 rdip t7
74 limm t1, imm
75 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
75 limm t1, imm, dataSize=asz
76 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
77 dataSize=asz
76 ld t1, seg, [1, t2, t7]
77 sexti t0, t1, imm, flags=(CF,)
78};
79
80def macroop BT_R_R {
81 sext t0, reg, regm, flags=(CF,)
82};
83
84def macroop BT_M_R {
78 ld t1, seg, [1, t2, t7]
79 sexti t0, t1, imm, flags=(CF,)
80};
81
82def macroop BT_R_R {
83 sext t0, reg, regm, flags=(CF,)
84};
85
86def macroop BT_M_R {
85 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
86 add t2, t2, base
87 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
88 dataSize=asz
89 add t2, t2, base, dataSize=asz
87 ld t1, seg, [scale, index, t2], disp
88 sext t0, t1, reg, flags=(CF,)
89};
90
91def macroop BT_P_R {
92 rdip t7
90 ld t1, seg, [scale, index, t2], disp
91 sext t0, t1, reg, flags=(CF,)
92};
93
94def macroop BT_P_R {
95 rdip t7
93 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
96 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
97 dataSize=asz
94 ld t1, seg, [1, t2, t7]
95 sext t0, t1, reg, flags=(CF,)
96};
97
98def macroop BTC_R_I {
99 sexti t0, reg, imm, flags=(CF,)
100 limm t1, 1
101 roli t1, t1, imm
102 xor reg, reg, t1
103};
104
105def macroop BTC_M_I {
98 ld t1, seg, [1, t2, t7]
99 sext t0, t1, reg, flags=(CF,)
100};
101
102def macroop BTC_R_I {
103 sexti t0, reg, imm, flags=(CF,)
104 limm t1, 1
105 roli t1, t1, imm
106 xor reg, reg, t1
107};
108
109def macroop BTC_M_I {
106 limm t1, imm
110 limm t1, imm, dataSize=asz
107 # This fudges just a tiny bit, but it's reasonable to expect the
108 # microcode generation logic to have the log of the various sizes
109 # floating around as well.
111 # This fudges just a tiny bit, but it's reasonable to expect the
112 # microcode generation logic to have the log of the various sizes
113 # floating around as well.
110 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
111 add t2, t2, base
114 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
115 dataSize=asz
116 add t2, t2, base, dataSize=asz
112 limm t3, 1
113 roli t3, t3, imm
114 ldst t1, seg, [scale, index, t2], disp
115 sexti t0, t1, imm, flags=(CF,)
116 xor t1, t1, t3
117 st t1, seg, [scale, index, t2], disp
118};
119
120def macroop BTC_P_I {
117 limm t3, 1
118 roli t3, t3, imm
119 ldst t1, seg, [scale, index, t2], disp
120 sexti t0, t1, imm, flags=(CF,)
121 xor t1, t1, t3
122 st t1, seg, [scale, index, t2], disp
123};
124
125def macroop BTC_P_I {
121 rdip t7
122 limm t1, imm
123 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
126 rdip t7, dataSize=asz
127 limm t1, imm, dataSize=asz
128 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
129 dataSize=asz
124 limm t3, 1
125 roli t3, t3, imm
126 ldst t1, seg, [1, t2, t7]
127 sexti t0, t1, imm, flags=(CF,)
128 xor t1, t1, t3
129 st t1, seg, [1, t2, t7], disp
130};
131
132def macroop BTC_R_R {
133 sext t0, reg, regm, flags=(CF,)
134 limm t1, 1
135 rol t1, t1, regm
136 xor reg, reg, t1
137};
138
139def macroop BTC_M_R {
130 limm t3, 1
131 roli t3, t3, imm
132 ldst t1, seg, [1, t2, t7]
133 sexti t0, t1, imm, flags=(CF,)
134 xor t1, t1, t3
135 st t1, seg, [1, t2, t7], disp
136};
137
138def macroop BTC_R_R {
139 sext t0, reg, regm, flags=(CF,)
140 limm t1, 1
141 rol t1, t1, regm
142 xor reg, reg, t1
143};
144
145def macroop BTC_M_R {
140 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
141 add t2, t2, base
146 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
147 dataSize=asz
148 add t2, t2, base, dataSize=asz
142 limm t3, 1
143 rol t3, t3, reg
144 ldst t1, seg, [scale, index, t2], disp
145 sext t0, t1, reg, flags=(CF,)
146 xor t1, t1, t3
147 st t1, seg, [scale, index, t2], disp
148};
149
150def macroop BTC_P_R {
149 limm t3, 1
150 rol t3, t3, reg
151 ldst t1, seg, [scale, index, t2], disp
152 sext t0, t1, reg, flags=(CF,)
153 xor t1, t1, t3
154 st t1, seg, [scale, index, t2], disp
155};
156
157def macroop BTC_P_R {
151 rdip t7
152 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
158 rdip t7, dataSize=asz
159 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
160 dataSize=asz
153 limm t3, 1
154 rol t3, t3, reg
155 ldst t1, seg, [1, t2, t7]
156 sext t0, t1, reg, flags=(CF,)
157 xor t1, t1, t3
158 st t1, seg, [1, t2, t7], disp
159};
160
161def macroop BTR_R_I {
162 sexti t0, reg, imm, flags=(CF,)
163 limm t1, "(uint64_t(-(2ULL)))"
164 roli t1, t1, imm
165 and reg, reg, t1
166};
167
168def macroop BTR_M_I {
161 limm t3, 1
162 rol t3, t3, reg
163 ldst t1, seg, [1, t2, t7]
164 sext t0, t1, reg, flags=(CF,)
165 xor t1, t1, t3
166 st t1, seg, [1, t2, t7], disp
167};
168
169def macroop BTR_R_I {
170 sexti t0, reg, imm, flags=(CF,)
171 limm t1, "(uint64_t(-(2ULL)))"
172 roli t1, t1, imm
173 and reg, reg, t1
174};
175
176def macroop BTR_M_I {
169 limm t1, imm
177 limm t1, imm, dataSize=asz
170 # This fudges just a tiny bit, but it's reasonable to expect the
171 # microcode generation logic to have the log of the various sizes
172 # floating around as well.
178 # This fudges just a tiny bit, but it's reasonable to expect the
179 # microcode generation logic to have the log of the various sizes
180 # floating around as well.
173 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
174 add t2, t2, base
181 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
182 dataSize=asz
183 add t2, t2, base, dataSize=asz
175 limm t3, "(uint64_t(-(2ULL)))"
176 roli t3, t3, imm
177 ldst t1, seg, [scale, index, t2], disp
178 sexti t0, t1, imm, flags=(CF,)
179 and t1, t1, t3
180 st t1, seg, [scale, index, t2], disp
181};
182
183def macroop BTR_P_I {
184 limm t3, "(uint64_t(-(2ULL)))"
185 roli t3, t3, imm
186 ldst t1, seg, [scale, index, t2], disp
187 sexti t0, t1, imm, flags=(CF,)
188 and t1, t1, t3
189 st t1, seg, [scale, index, t2], disp
190};
191
192def macroop BTR_P_I {
184 rdip t7
185 limm t1, imm
186 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
193 rdip t7, dataSize=asz
194 limm t1, imm, dataSize=asz
195 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
196 dataSize=asz
187 limm t3, "(uint64_t(-(2ULL)))"
188 roli t3, t3, imm
189 ldst t1, seg, [1, t2, t7]
190 sexti t0, t1, imm, flags=(CF,)
191 and t1, t1, t3
192 st t1, seg, [1, t2, t7], disp
193};
194
195def macroop BTR_R_R {
196 sext t0, reg, regm, flags=(CF,)
197 limm t1, "(uint64_t(-(2ULL)))"
198 rol t1, t1, regm
199 and reg, reg, t1
200};
201
202def macroop BTR_M_R {
197 limm t3, "(uint64_t(-(2ULL)))"
198 roli t3, t3, imm
199 ldst t1, seg, [1, t2, t7]
200 sexti t0, t1, imm, flags=(CF,)
201 and t1, t1, t3
202 st t1, seg, [1, t2, t7], disp
203};
204
205def macroop BTR_R_R {
206 sext t0, reg, regm, flags=(CF,)
207 limm t1, "(uint64_t(-(2ULL)))"
208 rol t1, t1, regm
209 and reg, reg, t1
210};
211
212def macroop BTR_M_R {
203 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
204 add t2, t2, base
213 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
214 dataSize=asz
215 add t2, t2, base, dataSize=asz
205 limm t3, "(uint64_t(-(2ULL)))"
206 rol t3, t3, reg
207 ldst t1, seg, [scale, index, t2], disp
208 sext t0, t1, reg, flags=(CF,)
209 and t1, t1, t3
210 st t1, seg, [scale, index, t2], disp
211};
212
213def macroop BTR_P_R {
216 limm t3, "(uint64_t(-(2ULL)))"
217 rol t3, t3, reg
218 ldst t1, seg, [scale, index, t2], disp
219 sext t0, t1, reg, flags=(CF,)
220 and t1, t1, t3
221 st t1, seg, [scale, index, t2], disp
222};
223
224def macroop BTR_P_R {
214 rdip t7
215 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
225 rdip t7, dataSize=asz
226 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
227 dataSize=asz
216 limm t3, "(uint64_t(-(2ULL)))"
217 rol t3, t3, reg
218 ldst t1, seg, [1, t2, t7]
219 sext t0, t1, reg, flags=(CF,)
220 and t1, t1, t3
221 st t1, seg, [1, t2, t7], disp
222};
223
224def macroop BTS_R_I {
225 sexti t0, reg, imm, flags=(CF,)
226 limm t1, 1
227 roli t1, t1, imm
228 or reg, reg, t1
229};
230
231def macroop BTS_M_I {
228 limm t3, "(uint64_t(-(2ULL)))"
229 rol t3, t3, reg
230 ldst t1, seg, [1, t2, t7]
231 sext t0, t1, reg, flags=(CF,)
232 and t1, t1, t3
233 st t1, seg, [1, t2, t7], disp
234};
235
236def macroop BTS_R_I {
237 sexti t0, reg, imm, flags=(CF,)
238 limm t1, 1
239 roli t1, t1, imm
240 or reg, reg, t1
241};
242
243def macroop BTS_M_I {
232 limm t1, imm
244 limm t1, imm, dataSize=asz
233 # This fudges just a tiny bit, but it's reasonable to expect the
234 # microcode generation logic to have the log of the various sizes
235 # floating around as well.
245 # This fudges just a tiny bit, but it's reasonable to expect the
246 # microcode generation logic to have the log of the various sizes
247 # floating around as well.
236 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
237 add t2, t2, base
248 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
249 dataSize=asz
250 add t2, t2, base, dataSize=asz
238 limm t3, 1
239 roli t3, t3, imm
240 ldst t1, seg, [scale, index, t2], disp
241 sexti t0, t1, imm, flags=(CF,)
242 or t1, t1, t3
243 st t1, seg, [scale, index, t2], disp
244};
245
246def macroop BTS_P_I {
251 limm t3, 1
252 roli t3, t3, imm
253 ldst t1, seg, [scale, index, t2], disp
254 sexti t0, t1, imm, flags=(CF,)
255 or t1, t1, t3
256 st t1, seg, [scale, index, t2], disp
257};
258
259def macroop BTS_P_I {
247 rdip t7
248 limm t1, imm
249 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
260 rdip t7, dataSize=asz
261 limm t1, imm, dataSize=asz
262 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
263 dataSize=asz
250 limm t3, 1
251 roli t3, t3, imm
252 ldst t1, seg, [1, t2, t7]
253 sexti t0, t1, imm, flags=(CF,)
254 or t1, t1, t3
255 st t1, seg, [1, t2, t7], disp
256};
257
258def macroop BTS_R_R {
259 sext t0, reg, regm, flags=(CF,)
260 limm t1, 1
261 rol t1, t1, regm
262 or reg, reg, t1
263};
264
265def macroop BTS_M_R {
264 limm t3, 1
265 roli t3, t3, imm
266 ldst t1, seg, [1, t2, t7]
267 sexti t0, t1, imm, flags=(CF,)
268 or t1, t1, t3
269 st t1, seg, [1, t2, t7], disp
270};
271
272def macroop BTS_R_R {
273 sext t0, reg, regm, flags=(CF,)
274 limm t1, 1
275 rol t1, t1, regm
276 or reg, reg, t1
277};
278
279def macroop BTS_M_R {
266 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
267 add t2, t2, base
280 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
281 dataSize=asz
282 add t2, t2, base, dataSize=asz
268 limm t3, 1
269 rol t3, t3, reg
270 ldst t1, seg, [scale, index, t2], disp
271 sext t0, t1, reg, flags=(CF,)
272 or t1, t1, t3
273 st t1, seg, [scale, index, t2], disp
274};
275
276def macroop BTS_P_R {
283 limm t3, 1
284 rol t3, t3, reg
285 ldst t1, seg, [scale, index, t2], disp
286 sext t0, t1, reg, flags=(CF,)
287 or t1, t1, t3
288 st t1, seg, [scale, index, t2], disp
289};
290
291def macroop BTS_P_R {
277 rdip t7
278 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)"
292 rdip t7, dataSize=asz
293 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \
294 dataSize=asz
279 limm t3, 1
280 rol t3, t3, reg
281 ldst t1, seg, [1, t2, t7]
282 sext t0, t1, reg, flags=(CF,)
283 or t1, t1, t3
284 st t1, seg, [1, t2, t7], disp
285};
286'''
295 limm t3, 1
296 rol t3, t3, reg
297 ldst t1, seg, [1, t2, t7]
298 sext t0, t1, reg, flags=(CF,)
299 or t1, t1, t3
300 st t1, seg, [1, t2, t7], disp
301};
302'''