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

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 11:28:31 PST 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics

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.


https://reviews.llvm.org/D40044

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtin-sqrt.c
  test/CodeGen/builtins.c
  test/CodeGen/libcalls.c
  test/CodeGen/math-builtins.c
  test/CodeGen/math-libcalls.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40044.122881.patch
Type: text/x-patch
Size: 35388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171114/060a5168/attachment-0001.bin>


More information about the cfe-commits mailing list