jbush001 / NyuziProcessor

GPGPU microprocessor architecture
Apache License 2.0
2k stars 351 forks source link

Saturating integer arithmetic operations #65

Open jbush001 opened 7 years ago

jbush001 commented 7 years ago

Investigate adding two new instructions that perform signed addition and subtraction, but check for overflow and handle as follows:

if a + b > 2^31-1
    sum = 2^31
else if a + b < -(2^31)
    sum = -(2^31)
else
    sum = a + b;

Useful for fixed point operations. Need a benchmark that could exercise use case.