bit_test.py (5306:79cedb731af5) | bit_test.py (5326:7e4cef0e528b) |
---|---|
1# Copyright (c) 2007 The Hewlett-Packard Development Company | 1# Copyright (c) 2008 The Regents of The University of Michigan |
2# All rights reserved. 3# | 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# |
|
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, --- 46 unchanged lines hidden (view full) --- 58 sexti t0, reg, imm, flags=(CF,) 59}; 60 61def macroop BT_M_I { 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. | 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, --- 46 unchanged lines hidden (view full) --- 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. |
66 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 67 dataSize=asz 68 add t2, t2, base, dataSize=asz 69 ld t1, seg, [scale, index, t2], disp | 94 ld t1, seg, sib, disp |
70 sexti t0, t1, imm, flags=(CF,) 71}; 72 73def macroop BT_P_I { 74 rdip t7 75 limm t1, imm, dataSize=asz | 95 sexti t0, t1, imm, flags=(CF,) 96}; 97 98def macroop BT_P_I { 99 rdip t7 100 limm t1, imm, dataSize=asz |
76 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 77 dataSize=asz 78 ld t1, seg, [1, t2, t7] | 101 ld t1, seg, riprel, disp, dataSize=asz |
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 { | 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 { |
87 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 88 dataSize=asz 89 add t2, t2, base, dataSize=asz 90 ld t1, seg, [scale, index, t2], disp | 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 |
91 sext t0, t1, reg, flags=(CF,) 92}; 93 94def macroop BT_P_R { 95 rdip t7 | 114 sext t0, t1, reg, flags=(CF,) 115}; 116 117def macroop BT_P_R { 118 rdip t7 |
96 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 97 dataSize=asz 98 ld t1, seg, [1, t2, 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 |
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 { 110 limm t1, imm, dataSize=asz 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. | 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. |
114 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 115 dataSize=asz 116 add t2, t2, base, dataSize=asz 117 limm t3, 1 118 roli t3, t3, imm 119 ldst t1, seg, [scale, index, t2], disp | 138 limm t4, 1 139 roli t4, t4, imm 140 ldst t1, seg, sib, disp |
120 sexti t0, t1, imm, flags=(CF,) | 141 sexti t0, t1, imm, flags=(CF,) |
121 xor t1, t1, t3 122 st t1, seg, [scale, index, t2], disp | 142 xor t1, t1, t4 143 st t1, seg, sib, disp |
123}; 124 125def macroop BTC_P_I { 126 rdip t7, dataSize=asz 127 limm t1, imm, dataSize=asz | 144}; 145 146def macroop BTC_P_I { 147 rdip t7, dataSize=asz 148 limm t1, imm, dataSize=asz |
128 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 129 dataSize=asz 130 limm t3, 1 131 roli t3, t3, imm 132 ldst t1, seg, [1, t2, t7] | 149 limm t4, 1 150 roli t4, t4, imm 151 ldst t1, seg, riprel, disp |
133 sexti t0, t1, imm, flags=(CF,) | 152 sexti t0, t1, imm, flags=(CF,) |
134 xor t1, t1, t3 135 st t1, seg, [1, t2, t7], disp | 153 xor t1, t1, t4 154 st t1, seg, riprel, 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 { | 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 { |
146 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 147 dataSize=asz 148 add t2, t2, base, dataSize=asz 149 limm t3, 1 150 rol t3, t3, reg 151 ldst t1, seg, [scale, index, t2], disp | 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 |
152 sext t0, t1, reg, flags=(CF,) | 171 sext t0, t1, reg, flags=(CF,) |
153 xor t1, t1, t3 154 st t1, seg, [scale, index, t2], disp | 172 xor t1, t1, t4 173 st t1, seg, [scale, index, t3], disp |
155}; 156 157def macroop BTC_P_R { 158 rdip t7, dataSize=asz | 174}; 175 176def macroop BTC_P_R { 177 rdip t7, dataSize=asz |
159 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 160 dataSize=asz 161 limm t3, 1 162 rol t3, t3, reg 163 ldst t1, seg, [1, t2, t7] | 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 |
164 sext t0, t1, reg, flags=(CF,) | 184 sext t0, t1, reg, flags=(CF,) |
165 xor t1, t1, t3 | 185 xor t1, t1, t4 |
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 { 177 limm t1, imm, dataSize=asz | 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 |
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. 181 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 182 dataSize=asz 183 add t2, t2, base, dataSize=asz 184 limm t3, "(uint64_t(-(2ULL)))" 185 roli t3, t3, imm 186 ldst t1, seg, [scale, index, t2], disp | 198 limm t4, "(uint64_t(-(2ULL)))" 199 roli t4, t4, imm 200 ldst t1, seg, sib, disp |
187 sexti t0, t1, imm, flags=(CF,) | 201 sexti t0, t1, imm, flags=(CF,) |
188 and t1, t1, t3 189 st t1, seg, [scale, index, t2], disp | 202 and t1, t1, t4 203 st t1, seg, sib, disp |
190}; 191 192def macroop BTR_P_I { 193 rdip t7, dataSize=asz 194 limm t1, imm, dataSize=asz | 204}; 205 206def macroop BTR_P_I { 207 rdip t7, dataSize=asz 208 limm t1, imm, dataSize=asz |
195 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 196 dataSize=asz 197 limm t3, "(uint64_t(-(2ULL)))" 198 roli t3, t3, imm 199 ldst t1, seg, [1, t2, t7] | 209 limm t4, "(uint64_t(-(2ULL)))" 210 roli t4, t4, imm 211 ldst t1, seg, riprel, disp |
200 sexti t0, t1, imm, flags=(CF,) | 212 sexti t0, t1, imm, flags=(CF,) |
201 and t1, t1, t3 202 st t1, seg, [1, t2, t7], disp | 213 and t1, t1, t4 214 st t1, seg, riprel, 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 { | 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 { |
213 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 214 dataSize=asz 215 add t2, t2, base, dataSize=asz 216 limm t3, "(uint64_t(-(2ULL)))" 217 rol t3, t3, reg 218 ldst t1, seg, [scale, index, t2], disp | 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 |
219 sext t0, t1, reg, flags=(CF,) | 231 sext t0, t1, reg, flags=(CF,) |
220 and t1, t1, t3 221 st t1, seg, [scale, index, t2], disp | 232 and t1, t1, t4 233 st t1, seg, [scale, index, t3], disp |
222}; 223 224def macroop BTR_P_R { 225 rdip t7, dataSize=asz | 234}; 235 236def macroop BTR_P_R { 237 rdip t7, dataSize=asz |
226 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 227 dataSize=asz 228 limm t3, "(uint64_t(-(2ULL)))" 229 rol t3, t3, reg 230 ldst t1, seg, [1, t2, t7] | 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 |
231 sext t0, t1, reg, flags=(CF,) | 244 sext t0, t1, reg, flags=(CF,) |
232 and t1, t1, t3 233 st t1, seg, [1, t2, t7], disp | 245 and t1, t1, t4 246 st t1, seg, [1, t3, 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 { 244 limm t1, imm, dataSize=asz | 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 |
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. 248 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 249 dataSize=asz 250 add t2, t2, base, dataSize=asz 251 limm t3, 1 252 roli t3, t3, imm 253 ldst t1, seg, [scale, index, t2], disp | 258 limm t4, 1 259 roli t4, t4, imm 260 ldst t1, seg, sib, disp |
254 sexti t0, t1, imm, flags=(CF,) | 261 sexti t0, t1, imm, flags=(CF,) |
255 or t1, t1, t3 256 st t1, seg, [scale, index, t2], disp | 262 or t1, t1, t4 263 st t1, seg, sib, disp |
257}; 258 259def macroop BTS_P_I { 260 rdip t7, dataSize=asz 261 limm t1, imm, dataSize=asz | 264}; 265 266def macroop BTS_P_I { 267 rdip t7, dataSize=asz 268 limm t1, imm, dataSize=asz |
262 srai t2, t1, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 263 dataSize=asz 264 limm t3, 1 265 roli t3, t3, imm 266 ldst t1, seg, [1, t2, t7] | 269 limm t4, 1 270 roli t4, t4, imm 271 ldst t1, seg, riprel, disp |
267 sexti t0, t1, imm, flags=(CF,) | 272 sexti t0, t1, imm, flags=(CF,) |
268 or t1, t1, t3 269 st t1, seg, [1, t2, t7], disp | 273 or t1, t1, t4 274 st t1, seg, riprel, 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 { | 275}; 276 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 { |
280 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 281 dataSize=asz 282 add t2, t2, base, dataSize=asz 283 limm t3, 1 284 rol t3, t3, reg 285 ldst t1, seg, [scale, index, t2], disp | 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 |
286 sext t0, t1, reg, flags=(CF,) | 291 sext t0, t1, reg, flags=(CF,) |
287 or t1, t1, t3 288 st t1, seg, [scale, index, t2], disp | 292 or t1, t1, t4 293 st t1, seg, [scale, index, t3], disp |
289}; 290 291def macroop BTS_P_R { 292 rdip t7, dataSize=asz | 294}; 295 296def macroop BTS_P_R { 297 rdip t7, dataSize=asz |
293 srai t2, reg, "(env.dataSize == 8) ? 3 : ((env.dataSize == 4) ? 2 : 1)", \ 294 dataSize=asz 295 limm t3, 1 296 rol t3, t3, reg 297 ldst t1, seg, [1, t2, t7] | 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 |
298 sext t0, t1, reg, flags=(CF,) | 304 sext t0, t1, reg, flags=(CF,) |
299 or t1, t1, t3 300 st t1, seg, [1, t2, t7], disp | 305 or t1, t1, t4 306 st t1, seg, [1, t3, t7], disp |
301}; 302''' | 307}; 308''' |