[cfe-dev] IR for the difference of two signed integers

Chris Lattner clattner at apple.com
Mon Mar 29 10:29:06 PDT 2010


On Mar 29, 2010, at 10:11 AM, Anton Yartsev wrote:

> Hi all,
> 
> While writing tests for AltiVec i found out that the sum of two signed integers is translated to IR as 'add nsw' while the difference of signed integers is translated to 'sub' without "No Signed Wrap" keyword. It seems that corresponding code for producing 'sub nsw' is missing in \clang\lib\CodeGen\CGExprScalar.cpp, ScalarExprEmitter::EmitSub(.) method. Attached is the patch that adds code for generating 'sub nsw' similar to the ScalarExprEmitter::EmitAdd(.) method. Please review.

Looks great, applied in r99817, thanks!

-Chris



More information about the cfe-dev mailing list