diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-01-24 20:25:37 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-01-24 20:25:37 +0000 |
| commit | 520a89e9d38bb1c9cc2de3f875eae3ac69f9f08a (patch) | |
| tree | 54fe8463a6692d6f8706ee98bffde249b43eed0c /lib/CodeGen/CGBuiltin.cpp | |
| parent | ead8c8e4f12a52fe33a395d4dce984c89ab04a77 (diff) | |
Vendor import of clang release_60 branch r323338:vendor/clang/clang-release_60-r323338
Notes
svn path=/vendor/clang/dist-release_60/; revision=328364
svn path=/vendor/clang/clang-release_60-r323338/; revision=328365; tag=vendor/clang/clang-release_60-r323338
Diffstat (limited to 'lib/CodeGen/CGBuiltin.cpp')
| -rw-r--r-- | lib/CodeGen/CGBuiltin.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index ba54f8342f1b..35ae114c4f25 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -915,7 +915,11 @@ EmitCheckedMixedSignMultiply(CodeGenFunction &CGF, const clang::Expr *Op1, Overflow = CGF.Builder.CreateOr(Overflow, TruncOverflow); } - Result = CGF.Builder.CreateTrunc(UnsignedResult, ResTy); + // Negate the product if it would be negative in infinite precision. + Result = CGF.Builder.CreateSelect( + IsNegative, CGF.Builder.CreateNeg(UnsignedResult), UnsignedResult); + + Result = CGF.Builder.CreateTrunc(Result, ResTy); } assert(Overflow && Result && "Missing overflow or result"); |
