sqrt(), sin(), cos(), pow(), exp(), exp2(), log(), log2(), and log10() are not available in variants which don't set errno on glibc (and maybe other more obscure platforms), so don't claim they're universally available in TargetLowering.cpp. Then fix LangRef to make it obvious that they in fact have no side-effects, and get rid of the silly sqrt() special-case.
TODO:
- Make the backend error message print out the actual name of the intrinsic rather than a number.
- Provide libcall lowerings for these intrinsics on platforms where they're available.
- Provide a target API to check whether these intrinsics are available, and use it (SimplifyLibCalls, vectorizer)
- Fix ConstantFolding so it doesn't assume the operand to llvm.sqrt() is positive
- Fix regression tests (60-ish failures at the moment).
- Fix clang so it doesn't generate calls to llvm.sqrt() and llvm.pow() when they aren't available.
- Fix clang so it doesn't mark calls which have side-effects readnone.
Sort of a response to https://reviews.llvm.org/D27618 and other related discussion lately. I'm not sure when I'll have time to finish this.