Add Two Signed Integers With Saturation

SADD

 

 

 

 

Add Two Signed Integers With Saturation

 

 

 

 

 

 

SADD

 

 

 

 

 

 

 

 

 

Syntax

 

 

 

 

SADD (.unit) src1, src2, dst

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.unit = .L1 or .L2

 

 

 

 

 

 

 

 

 

 

 

Compatibility

 

 

C62x, C64x, C67x, and C67x+ CPU

 

 

 

 

 

 

 

 

Opcode

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

31

29

28

27

23

22

18

17

13

12

11

5

4

3

2

1

0

creg

z

dst

src2

src1

x

op

1

1

0s

p

3 1555171 1

Opcode map field used...

For operand type...

Unit

Opfield

 

 

 

 

src1

sint

.L1, .L2

001 0011

src2

xsint

 

 

dst

sint

 

 

src1

xsint

.L1, .L2

011 0001

src2

slong

 

 

dst

slong

 

 

src1

scst5

.L1, .L2

001 0010

src2

xsint

 

 

dst

sint

 

 

src1

scst5

.L1, .L2

011 0000

src2

slong

 

 

dst

slong

 

 

 

 

 

 

Description

src1 is added to src2 and saturated, if an overflow occurs according to the

 

following rules:

 

1)

If the dst is an int and src1 + src2 > 231 − 1, then the result is 231 − 1.

 

2)

If the dst is an int and src1 + src2 < −231, then the result is −231.

 

3)

If the dst is a long and src1 + src2 > 239 − 1, then the result is 239 − 1.

 

4)

If the dst is a long and src1 + src2 < −239, then the result is −239.

 

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

 

SPRU733

Instruction Set

3-205

Page 265
Image 265
Texas Instruments TMS320C67X/C67X+ DSP manual Add Two Signed Integers With Saturation, Sadd