This is a partial implementation of a fix for PR35672:
https://bugs.llvm.org/show_bug.cgi?id=35672
If this is on the right track, then I can add similar code for other transcendentals (exp2, log, log10, log2, pow).
Some questions:
- 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.
- Does this make sense for ISD::STRICT_FEXP (the strict version of the node)?
- Does the mathlib actually support the long double variants?
"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).