[PATCH] D46986: [Fixed Point Arithmetic] Validation Test for Fixed Point Binary Operations and Saturated Addition

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 16 15:47:34 PDT 2018


leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr, jakehehrlich.
leonardchan added a project: clang.

This patch contains tests for validating the logic behind each builtin operation on fixed point types and tests on addition between saturated _Fract types.

- More macros wer added to the FixedPoint.h header on the min and max values for each type which will be required for operations on saturated types.
- Updated the logic when converting between fixed point types to take into account saturation. Fixed point type conversions do not fall under the "usual arithmetic conversions" where the resulting type on a binary operation resulting in a fixed point type does not need to be the type of either operands.
- Rounded down _Fract literals of 1 (1.0hr, 1.0r, 1.0lr) to the respective maximum values for each _Fract type.

This is a child of https://reviews.llvm.org/D46979


Repository:
  rC Clang

https://reviews.llvm.org/D46986

Files:
  include/clang/AST/Type.h
  include/clang/Basic/FixedPoint.h.in
  lib/AST/Type.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Sema/SemaExpr.cpp
  test/Frontend/fixed_point_all_builtin_operations.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46986.147205.patch
Type: text/x-patch
Size: 20104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180516/53f80ea5/attachment-0001.bin>


More information about the cfe-commits mailing list