Integer Addition With Saturation to Result Size
SADD
3-101
TMS320C62x/C67x Fixed-Point Instruction Set
Syntax
SADD (.unit)
src1, src2, dst
.unit = .L1 or .L2
Opcode map field used...
For operand type...
Unit
Opfield
src1
src2
dst
sint
xsint
sint
.L1, .L2
0010011
src1
src2
dst
xsint
slong
slong
.L1, .L2
0110001
src1
src2
dst
scst5
xsint
sint
.L1, .L2
0010010
src1
src2
dst
scst5
slong
slong
.L1, .L2
0110000
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
src 2
src 1/cst
Description
src1 is added to src2 and saturated if an overflow occurs according to the fol-
lowing rules:
1) If the
dst is an int and src1 + src2 > 2
31
– 1, then the result is 2
31
– 1.
2) If the
dst is an int and src1 + src2 < –2
31
, then the result is –2
31
.
3) If the
dst is a long and src1 + src2 > 2
39
– 1, then the result is 2
39
– 1.
4) If the
dst is a long and src1 + src2 < –2
39
, then the result is –2
39
.
The result is placed in
dst. If a saturate occurs, the SAT bit in the control status
register (CSR) is set one cycle after
dst is written.
Execution
if (cond)
src1 +s src2
→
dst
else
nop