bit_scan.py (5661:443e6f925027) bit_scan.py (6344:b7104eda0795)
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

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

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 BSR_R_R {
86 # Determine if the input was zero, and also move it to a temp reg.
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

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

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 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
87 mov t1, t1, t0, dataSize=8
88 and t1, regm, regm, flags=(ZF,)
89 br label("end"), flags=(CZF,)
90
91 # Zero out the result register
92 movi reg, reg, 0x0
93
94 # Bit 6
95 srli t3, t1, 32, dataSize=8, flags=(EZF,)

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

127 mov reg, reg, t4, flags=(nCEZF,)
128
129end:
130 fault "NoFault"
131};
132
133def macroop BSR_R_M {
134
88 and t1, regm, regm, flags=(ZF,)
89 br label("end"), flags=(CZF,)
90
91 # Zero out the result register
92 movi reg, reg, 0x0
93
94 # Bit 6
95 srli t3, t1, 32, dataSize=8, flags=(EZF,)

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

127 mov reg, reg, t4, flags=(nCEZF,)
128
129end:
130 fault "NoFault"
131};
132
133def macroop BSR_R_M {
134
135 movi t1, t1, t0, dataSize=8
135 mov t1, t1, t0, dataSize=8
136 ld t1, seg, sib, disp
137
138 # Determine if the input was zero, and also move it to a temp reg.
139 and t1, t1, t1, flags=(ZF,)
140 br label("end"), flags=(CZF,)
141
142 # Zero out the result register
143 movi reg, reg, 0x0

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

179
180end:
181 fault "NoFault"
182};
183
184def macroop BSR_R_P {
185
186 rdip t7
136 ld t1, seg, sib, disp
137
138 # Determine if the input was zero, and also move it to a temp reg.
139 and t1, t1, t1, flags=(ZF,)
140 br label("end"), flags=(CZF,)
141
142 # Zero out the result register
143 movi reg, reg, 0x0

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

179
180end:
181 fault "NoFault"
182};
183
184def macroop BSR_R_P {
185
186 rdip t7
187 movi t1, t1, t0, dataSize=8
187 mov t1, t1, t0, dataSize=8
188 ld t1, seg, riprel, disp
189
190 # Determine if the input was zero, and also move it to a temp reg.
191 and t1, t1, t1, flags=(ZF,)
192 br label("end"), flags=(CZF,)
193
194 # Zero out the result register
195 movi reg, reg, 0x0

--- 203 unchanged lines hidden ---
188 ld t1, seg, riprel, disp
189
190 # Determine if the input was zero, and also move it to a temp reg.
191 and t1, t1, t1, flags=(ZF,)
192 br label("end"), flags=(CZF,)
193
194 # Zero out the result register
195 movi reg, reg, 0x0

--- 203 unchanged lines hidden ---