Page MenuHomePhabricator

[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics

Authored by spatel on Nov 14 2017, 11:26 AM.



There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:

We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign, fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.

This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a check for const-ness to make sure we're not doing the transform if errno could possibly be set by the libcall or builtin.

Diff Detail

rC Clang