[PATCH] D49876: [Fixed Point Arithmetic] Addition of intrinsic/builtin functions

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 26 15:10:54 PDT 2018


leonardchan created this revision.
leonardchan added a project: clang.
Herald added a subscriber: cfe-commits.

This patch is not actually up for review and meant to hold the remaining work done after https://reviews.llvm.org/D47017 but haven't submitted for review yet.

This patch contains:

- `mulifx()` family functions. This essentially performs multiplication on _Accum/long _Accum types with integers but returns an integer instead of fixed point type.
- Intrinsic wrapper functions for `log2()`/`log10()`. These were not specified in Embedded-C, but were requested by the networking team. These functions are able to calculate a value up to 31 bits of precision (same as the default long _Accum scale), and have an error within 1 unit of precision of the true answer (error < 1/2^31).
- Intrinsic wrapper function for `pow10()`. Also requested by the networking team, and can also calculate a value with up to 31 bits of precision and an error within 1 unit of precision of the true answer.
- Corrected logic for scalar conversions between fixed points and floats
- Starting code for `FX_FULL_PRECISION` pragma


Repository:
  rC Clang

https://reviews.llvm.org/D49876

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/TokenKinds.def
  include/clang/Parse/Parser.h
  lib/AST/ASTContext.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Parse/ParsePragma.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  test/Frontend/fixed_point_all_conversions.c
  test/Frontend/fixed_point_mulifx_validation.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49876.157583.patch
Type: text/x-patch
Size: 30445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180726/cd175160/attachment-0001.bin>


More information about the cfe-commits mailing list