]> granicus.if.org Git - clang/commit
[Fixed Point Arithmetic] Fixed Point Addition
authorLeonard Chan <leonardchan@google.com>
Wed, 16 Jan 2019 18:13:59 +0000 (18:13 +0000)
committerLeonard Chan <leonardchan@google.com>
Wed, 16 Jan 2019 18:13:59 +0000 (18:13 +0000)
commitad18a0d69778c7a02e398967aafd92318fc50a58
tree335e240f0f457c68f7ba4c149b1431d6764ad5d1
parent0d0de09b85ea80b4da888d5555cba1240e119f4e
[Fixed Point Arithmetic] Fixed Point Addition

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
include/clang/AST/ASTContext.h
include/clang/AST/Type.h
include/clang/Basic/FixedPoint.h
lib/AST/ASTContext.cpp
lib/Basic/FixedPoint.cpp
lib/CodeGen/CGExprScalar.cpp
lib/Sema/SemaExpr.cpp
test/Frontend/fixed_point_add.c [new file with mode: 0644]
test/Frontend/fixed_point_conversions.c