[PATCH] D41338: [CodeGen] lower math intrinsics to finite version of libcalls when possible (PR35672)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 11:05:12 PST 2017


efriedma added a comment.

> Do the finite calls need the double-leading underscores? I saw an existing test with __sqrt_finite, so I assume we want those, but I'm not sure if/how the regular calls acquire the underscores.

That's just how they're named; the names come from the glibc headers.

> Does this make sense for ISD::STRICT_FEXP (the strict version of the node)?

I would guess strict and fast math don't really mix...

> Does the mathlib actually support the long double variants?

long double variants should exist, as far as I know... at least for the "long double" which is native for the platform.



================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:4049
   case ISD::STRICT_FEXP:
-    Results.push_back(ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64,
-                                      RTLIB::EXP_F80, RTLIB::EXP_F128,
-                                      RTLIB::EXP_PPCF128));
+    if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_exp_finite))
+      Results.push_back(ExpandFPLibCall(Node, RTLIB::EXP_FINITE_F32,
----------------
"getLibInfo().has(LibFunc_exp_finite)" probably isn't the right check.  There are three __exp*_finite variants; each of them may or may not be legal, and you need to check that the long double variant actually accepts the input float type.

Also, it looks like TargetLibraryInfo doesn't contain the appropriate checks to disable them (it assumes any non-Windows platform has __exp_finite, which is clearly false).


https://reviews.llvm.org/D41338





More information about the llvm-commits mailing list