[PATCH] D28335: [WIP] [RFC] Don't lower floating point intrinsics to libcalls which modify errno

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 16:43:07 PST 2017


efriedma created this revision.
efriedma added subscribers: llvm-commits, spatel, avt77, hfinkel, RKSimon.
efriedma set the repository for this revision to rL LLVM.

`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.


Repository:
  rL LLVM

https://reviews.llvm.org/D28335

Files:
  docs/LangRef.rst
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/Target/AArch64/AArch64FastISel.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28335.83161.patch
Type: text/x-patch
Size: 12623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/bc82745c/attachment.bin>


More information about the llvm-commits mailing list