Add saturating addition/subtraction#6647
Conversation
95f7c8d to
22ae750
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6647 +/- ##
=========================================
Coverage 76.73% 76.74%
=========================================
Files 1579 1579
Lines 182008 182173 +165
=========================================
+ Hits 139671 139803 +132
- Misses 42337 42370 +33
Continue to review full report at Codecov.
|
22ae750 to
98f43f7
Compare
98f43f7 to
c6c6938
Compare
ed29bfa to
518af1c
Compare
chris-ryder
left a comment
There was a problem hiding this comment.
Assuming I've followed all the bit operations correctly, I think that looks reasonable to me. As an aside, the phrase "For C code, it takes MMX instructions to have access to this" of course only applies to x86/amd64. ARM of course has it's own instructions and compiler intrinsics for saturated arithmetic.
| else if(expr.id() == ID_bitreverse) | ||
| return convert_bitreverse(to_bitreverse_expr(expr)); | ||
| else if(expr.id() == ID_saturating_minus || expr.id() == ID_saturating_plus) | ||
| return convert_saturating_add_sub(to_binary_expr(expr)); |
There was a problem hiding this comment.
Minor nit pick... there's a mis-match of terminology here - plus vs add, minus vs sub - should we pick one and settle?
50a4004 to
22defef
Compare
Rust natively supports saturating arithmetic. For C code, it takes MMX instructions to have access to this (which will be implemented in the next commit), and even then it is limited to addition and subtraction. The implementation now is equally restricted to these two arithmetic operations. Fixes: diffblue#5841
With the newly added saturating addition/subtraction it is possible to support MMX instructions performing saturating arithmetic over vectors.
22defef to
10ea245
Compare
Rust natively supports saturating arithmetic. For C code, it takes MMX
instructions to have access to this, and even then it is limited to
addition and subtraction. The implementation now is equally restricted
to these two arithmetic operations.