summaryrefslogtreecommitdiffstats
path: root/lib/Basic/FixedPoint.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Fixed Point Arithmetic] Fixed Point and Integer ConversionsLeonard Chan2019-03-061-0/+37
| | | | | | | | | This patch includes the necessary code for converting between a fixed point type and integer. This also includes constant expression evaluation for conversions with these types. Differential Revision: https://reviews.llvm.org/D56900 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355462 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fixed Point Arithmetic] Fixed Point Addition Constant Expression EvaluationLeonard Chan2019-01-181-9/+64
| | | | | | | | This patch includes logic for constant expression evaluation of fixed point additions. Differential Revision: https://reviews.llvm.org/D55868 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351593 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fixed Point Arithmetic] Add APFixedPoint to APValueLeonard Chan2019-01-161-0/+27
| | | | | | | | This adds APFixedPoint to the union of values that can be represented with an APValue. Differential Revision: https://reviews.llvm.org/D56746 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351368 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fixed Point Arithmetic] Fixed Point AdditionLeonard Chan2019-01-161-0/+25
| | | | | | | | | | | | | | | | | | This patch covers addition between fixed point types and other fixed point types or integers, using the conversion rules described in 4.1.4 of N1169. Usual arithmetic rules do not apply to binary operations when one of the operands is a fixed point type, and the result of the operation must be calculated with the full precision of the operands, so we should not perform any casting to a common type. This patch does not include constant expression evaluation for addition of fixed point types. That will be addressed in another patch since I think this one is already big enough. Differential Revision: https://reviews.llvm.org/D53738 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351364 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for broken build on clang-hexagon-elf for ambiguous call toLeonard Chan2018-08-061-1/+2
| | | | | | std::abs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339044 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fixed Point Arithmetic] Remove unused include.Benjamin Kramer2018-08-061-1/+0
| | | | | | lib/Basic cannot depend on lib/AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339031 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fixed Point Arithmetic] Fixed Point ConstantLeonard Chan2018-08-061-0/+115
This patch proposes an abstract type that represents fixed point numbers, similar to APInt or APSInt that was discussed in https://reviews.llvm.org/D48456#inline-425585. This type holds a value, scale, and saturation and is meant to perform intermediate calculations on constant fixed point values. Currently this class is used as a way for handling the conversions between fixed point numbers with different sizes and radixes. For example, if I'm casting from a signed _Accum to a saturated unsigned short _Accum, I will need to check the value of the signed _Accum to see if it fits into the short _Accum which involves getting and comparing against the max/min values of the short _Accum. The FixedPointNumber class currently handles the radix shifting and extension when converting to a signed _Accum. Differential Revision: https://reviews.llvm.org/D48661 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339028 91177308-0d34-0410-b5e6-96231b3b80d8