bit_scan.py (5333:0e394c08dcbc) | bit_scan.py (5414:bed5152f6368) |
---|---|
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 --- 68 unchanged lines hidden (view full) --- 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 = ''' | 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 --- 68 unchanged lines hidden (view full) --- 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 BSF_R_R { | 85def macroop BSR_R_R { |
86 # Determine if the input was zero, and also move it to a temp reg. 87 movi t1, t1, t0, dataSize=8 88 and t1, regm, regm, flags=(ZF,) 89 bri t0, label("end"), flags=(CZF,) 90 91 # Zero out the result register 92 movi reg, reg, 0x0 93 --- 32 unchanged lines hidden (view full) --- 126 ori t4, reg, 0x1 127 mov reg, reg, t4, flags=(nCEZF,) 128 mov t1, t1, t3, flags=(nCEZF,) 129 130end: 131 fault "NoFault" 132}; 133 | 86 # Determine if the input was zero, and also move it to a temp reg. 87 movi t1, t1, t0, dataSize=8 88 and t1, regm, regm, flags=(ZF,) 89 bri t0, label("end"), flags=(CZF,) 90 91 # Zero out the result register 92 movi reg, reg, 0x0 93 --- 32 unchanged lines hidden (view full) --- 126 ori t4, reg, 0x1 127 mov reg, reg, t4, flags=(nCEZF,) 128 mov t1, t1, t3, flags=(nCEZF,) 129 130end: 131 fault "NoFault" 132}; 133 |
134def macroop BSF_R_M { | 134def macroop BSR_R_M { |
135 136 movi t1, t1, t0, dataSize=8 137 ld t1, seg, sib, disp 138 139 # Determine if the input was zero, and also move it to a temp reg. 140 and t1, t1, t1, flags=(ZF,) 141 bri t0, label("end"), flags=(CZF,) 142 --- 35 unchanged lines hidden (view full) --- 178 ori t4, reg, 0x1 179 mov reg, reg, t4, flags=(nCEZF,) 180 mov t1, t1, t3, flags=(nCEZF,) 181 182end: 183 fault "NoFault" 184}; 185 | 135 136 movi t1, t1, t0, dataSize=8 137 ld t1, seg, sib, disp 138 139 # Determine if the input was zero, and also move it to a temp reg. 140 and t1, t1, t1, flags=(ZF,) 141 bri t0, label("end"), flags=(CZF,) 142 --- 35 unchanged lines hidden (view full) --- 178 ori t4, reg, 0x1 179 mov reg, reg, t4, flags=(nCEZF,) 180 mov t1, t1, t3, flags=(nCEZF,) 181 182end: 183 fault "NoFault" 184}; 185 |
186def macroop BSF_R_P { | 186def macroop BSR_R_P { |
187 188 rdip t7 189 movi t1, t1, t0, dataSize=8 190 ld t1, seg, riprel, disp 191 192 # Determine if the input was zero, and also move it to a temp reg. 193 and t1, t1, t1, flags=(ZF,) 194 bri t0, label("end"), flags=(CZF,) --- 36 unchanged lines hidden (view full) --- 231 ori t4, reg, 0x1 232 mov reg, reg, t4, flags=(nCEZF,) 233 mov t1, t1, t3, flags=(nCEZF,) 234 235end: 236 fault "NoFault" 237}; 238 | 187 188 rdip t7 189 movi t1, t1, t0, dataSize=8 190 ld t1, seg, riprel, disp 191 192 # Determine if the input was zero, and also move it to a temp reg. 193 and t1, t1, t1, flags=(ZF,) 194 bri t0, label("end"), flags=(CZF,) --- 36 unchanged lines hidden (view full) --- 231 ori t4, reg, 0x1 232 mov reg, reg, t4, flags=(nCEZF,) 233 mov t1, t1, t3, flags=(nCEZF,) 234 235end: 236 fault "NoFault" 237}; 238 |
239def macroop BSR_R_R { | 239def macroop BSF_R_R { |
240 # Determine if the input was zero, and also move it to a temp reg. 241 mov t1, t1, t0, dataSize=8 242 and t1, regm, regm, flags=(ZF,) 243 bri t0, label("end"), flags=(CZF,) 244 245 # Zero out the result register 246 movi reg, reg, 0 247 --- 29 unchanged lines hidden (view full) --- 277 srli t3, t1, 1, dataSize=8 278 andi t3, t3, 1 279 or reg, reg, t3 280 281end: 282 fault "NoFault" 283}; 284 | 240 # Determine if the input was zero, and also move it to a temp reg. 241 mov t1, t1, t0, dataSize=8 242 and t1, regm, regm, flags=(ZF,) 243 bri t0, label("end"), flags=(CZF,) 244 245 # Zero out the result register 246 movi reg, reg, 0 247 --- 29 unchanged lines hidden (view full) --- 277 srli t3, t1, 1, dataSize=8 278 andi t3, t3, 1 279 or reg, reg, t3 280 281end: 282 fault "NoFault" 283}; 284 |
285def macroop BSR_R_M { | 285def macroop BSF_R_M { |
286 287 mov t1, t1, t0, dataSize=8 288 ld t1, seg, sib, disp 289 290 # Determine if the input was zero, and also move it to a temp reg. 291 and t1, t1, t1, flags=(ZF,) 292 bri t0, label("end"), flags=(CZF,) 293 --- 32 unchanged lines hidden (view full) --- 326 srli t3, t1, 1, dataSize=8 327 andi t3, t3, 1 328 or reg, reg, t3 329 330end: 331 fault "NoFault" 332}; 333 | 286 287 mov t1, t1, t0, dataSize=8 288 ld t1, seg, sib, disp 289 290 # Determine if the input was zero, and also move it to a temp reg. 291 and t1, t1, t1, flags=(ZF,) 292 bri t0, label("end"), flags=(CZF,) 293 --- 32 unchanged lines hidden (view full) --- 326 srli t3, t1, 1, dataSize=8 327 andi t3, t3, 1 328 or reg, reg, t3 329 330end: 331 fault "NoFault" 332}; 333 |
334def macroop BSR_R_P { | 334def macroop BSF_R_P { |
335 336 rdip t7 337 mov t1, t1, t0, dataSize=8 338 ld t1, seg, riprel, disp 339 340 # Determine if the input was zero, and also move it to a temp reg. 341 and t1, t1, t1, flags=(ZF,) 342 bri t0, label("end"), flags=(CZF,) --- 41 unchanged lines hidden --- | 335 336 rdip t7 337 mov t1, t1, t0, dataSize=8 338 ld t1, seg, riprel, disp 339 340 # Determine if the input was zero, and also move it to a temp reg. 341 and t1, t1, t1, flags=(ZF,) 342 bri t0, label("end"), flags=(CZF,) --- 41 unchanged lines hidden --- |