Add a llvm.copysign intrinsic
authorHal Finkel <hfinkel@anl.gov>
Mon, 19 Aug 2013 23:35:46 +0000 (23:35 +0000)
committerHal Finkel <hfinkel@anl.gov>
Mon, 19 Aug 2013 23:35:46 +0000 (23:35 +0000)
commit66d1fa6f4b443ac9f8bcea5d1f71a73ada733a42
tree93e47ddf0c8e56f76d676971f3247e9f42d7e49f
parent30cbccb029b01738202bd04341b1cbf68a7814c9
Add a llvm.copysign intrinsic

This adds a llvm.copysign intrinsic; We already have Libfunc recognition for
copysign (which is turned into the FCOPYSIGN SDAG node). In order to
autovectorize calls to copysign in the loop vectorizer, we need a corresponding
intrinsic as well.

In addition to the expected changes to the language reference, the loop
vectorizer, BasicTTI, and the SDAG builder (the intrinsic is transformed into
an FCOPYSIGN node, just like the function call), this also adds FCOPYSIGN to a
few lists in LegalizeVector{Ops,Types} so that vector copysigns can be
expanded.

In TargetLoweringBase::initActions, I've made the default action for FCOPYSIGN
be Expand for vector types. This seems correct for all in-tree targets, and I
think is the right thing to do because, previously, there was no way to generate
vector-values FCOPYSIGN nodes (and most targets don't specify an action for
vector-typed FCOPYSIGN).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188728 91177308-0d34-0410-b5e6-96231b3b80d8
docs/LangRef.rst
include/llvm/IR/Intrinsics.td
lib/CodeGen/BasicTargetTransformInfo.cpp
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/TargetLoweringBase.cpp
lib/Target/PowerPC/PPCCTRLoops.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/intrinsic.ll