[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 27 10:34:51 PDT 2018
leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr, jakehehrlich, rsmith, ebevhan, rjmccall.
leonardchan added a project: clang.
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.
Tests will be added next. Just wanted to expose the type now in case anyone has any early comments.
Repository:
rC Clang
https://reviews.llvm.org/D48661
Files:
include/clang/AST/ASTContext.h
include/clang/Basic/FixedPoint.h
include/clang/Basic/TargetInfo.h
lib/AST/ASTContext.cpp
lib/Sema/SemaExpr.cpp
test/Frontend/fixed_point_declarations.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48661.153119.patch
Type: text/x-patch
Size: 11544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180627/38a6e309/attachment.bin>
More information about the cfe-commits
mailing list