LMBD
Leftmost Bit Detection
3-74
Syntax
LMBD (.unit)
src1, src2, dst
.unit = .L1 or .L2
Opcode map field used...
For operand type...
Unit
Opfield
src1
src2
dst
uint
xuint
uint
.L1, .L2
1101011
src1
src2
dst
cst5
xuint
uint
.L1, .L2
1101010
Opcode
31
29 28 27
23 22
18 17
creg
z
dst
13 12 11
5
4
3
2
1
0
x
op
1
1
0
s
p
3
5
5
5
7
src2
src1/cst
Description
The LSB of the
src1 operand determines whether to search for a leftmost 1 or
0 in
src2. The number of bits to the left of the first 1 or 0 when searching for
a 1 or 0, respectively, is placed in
dst.
The following diagram illustrates the operation of LMBD for several cases.
1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x
0 1 x x x x x x
x x x x x x x x x x x x x x x
x
x
x x
x
x
x
x
x x x x x x x
0
0
0
x x
x
0
1
x
x x x x x x x x
x
x
x
x
x
x
x
x
When searching for 1 in
src2, LMBD returns 4:
When searching for 0 in
src2, LMBD returns 32:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
9
8
7
6
5
4
3
2
1
0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
9
8
7
6
5
4
3
2
1
0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
9
8
7
6
5
4
3
2
1
0
When searching for 0 in
src2, LMBD returns 0:
Execution
if (cond)
{
if (
src1
0
==
0) lmb0(
src2)
→
dst
if (
src1
0
==
1) lmb1(
src2)
→
dst
}
else
nop