[PATCH] D57553: [Fixed Point Arithmetic] Check against source value when converting during saturation

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 31 15:59:31 PST 2019


leonardchan created this revision.
leonardchan added reviewers: rjmccall, ebevhan, bjope.
leonardchan added a project: clang.

When converting to a saturating fixed point type, compare against the source value instead of our container value. This allows us to not create a container, and save up to 2 instructions from extending/truncating to this container size.

These can be seen in conversions between fixed point types of the same width, but different scale or different sign.


Repository:
  rC Clang

https://reviews.llvm.org/D57553

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/Frontend/fixed_point_add.c
  clang/test/Frontend/fixed_point_conversions.c
  clang/test/Frontend/fixed_point_sub.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57553.184641.patch
Type: text/x-patch
Size: 22960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190131/54801c29/attachment-0001.bin>


More information about the cfe-commits mailing list