[PATCH] D53738: [Fixed Point Arithmetic] Fixed Point Addition

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 26 21:30:57 PDT 2018


rjmccall added a comment.

In https://reviews.llvm.org/D53738#1277172, @ebevhan wrote:

> I want to float the idea again of adding an AST type to encapsulate an arbitrary fixed-point semantic and using that as the 'common type' for binary operations involving fixed-point types. This would enable UsualArithmeticConversions to handle fixed-point types similarly to how it does today (find the 'common' full precision type, implicitly cast the LHS and RHS if necessary). There is one new thing that it would have to do; the result after the operation should not be the full precision type, but rather be casted to the operand type of highest rank. I don't think the existing code in SemaExpr can handle the case of adding an implicit cast after the operation. I don't think it should be hard to add, though.


I don't think we should add *types* just for this, but if you need to make a different kind of `BinaryOperator` that represents that the semantics aren't quite the same (the same way that the compound assignments have their own subclass), that seems natural to me.


Repository:
  rC Clang

https://reviews.llvm.org/D53738





More information about the cfe-commits mailing list