This is an archive of the discontinued LLVM Phabricator instance.

[Fixed Point Arithmetic] Addition of intrinsic/builtin functions
Needs ReviewPublic

Authored by leonardchan on Jul 26 2018, 3:10 PM.

Details

Reviewers
phosek
mcgrathr
Summary

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

Diff Detail

Repository
rC Clang