HomePhabricator

[compiler-rt][builtins][PowerPC] Implemented __fixunstfti builtin on PowerPC

Authored by amyk on Jan 10 2019, 4:30 AM.

Description

[compiler-rt][builtins][PowerPC] Implemented __fixunstfti builtin on PowerPC

This patch implements the uint128_t fixunstfti (long double) method for
PowerPC -- specifically to convert a long double (IBM double-double) to an
unsigned 128 bit integer.

The general approach of this algorithm is to convert the high and low doubles
of the long double and add them together if the doubles fit within 64 bits.
However, additional adjustments and scaling is performed when the high or low
double does not fit within a 64 bit integer.

To invoke this method, one can do so by linking against compiler-rt, via the
--rtlib=compiler-rt command line option supplied to clang.

Differential Revision: https://reviews.llvm.org/D54911

llvm-svn: 350815