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

Anton Yartsev anton.yartsev at gmail.com
Mon Mar 29 10:11:50 PDT 2010


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.

-- 
Anton

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CGExprScalar.diff
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100329/885ebc72/attachment.ksh>


More information about the cfe-dev mailing list