[PATCH] D14327: Add llvm.ldexp.* intrinsic, associated SDNode and library calls

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 13:00:07 PST 2015


nhaehnle updated this revision to Diff 39403.
nhaehnle added a comment.

Thank you for taking a look! I've made some changes based on your feedback:

- AMDGPU: more llvm.ldexp.ll tests and assorted bugfixes
- LangRef for llvm.ldexp.*: remove statement about handling error conditions
- [VectorUtils] llvm.ldexp.* intrinsic is vectorizable
- [ValueTracking] ldexp preserves the sign of its first argument

I agree that the error handling is a problem, and I have to admit that I don't
know what is best. At the time of the libcall transformation, we already have
an SDNode, so I do not know how to tell the attributes of the original call.

It's also some effort to provide an expansion that is guaranteed to never set
errno, because the most straightforward expansion uses exp2, which is in turn
likely to become a library call. I suppose one could write a custom implementation
in compiler-rt, but I don't think that that's the best use of my time.

For now, I have made changes that are in line with the other intrinsics like pow
and powi: those are marked as isTriviallyVectorizable, but *not* as
isSafeToSpeculativelyExecute.

I hope that this is good enough. There are quite a number of TODOs already in
the code regarding these error problems. In any case, I've left those changes
as separate commits locally, so it's easy enough for me to rearrange them.
(Though at least for some of them I believe they should definitely be squashed
before committing to SVN.)


http://reviews.llvm.org/D14327

Files:
  docs/LangRef.rst
  include/llvm/Analysis/TargetLibraryInfo.h
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/CodeGen/RuntimeLibcalls.h
  include/llvm/IR/Intrinsics.td
  include/llvm/Target/TargetSelectionDAG.td
  lib/Analysis/ValueTracking.cpp
  lib/Analysis/VectorUtils.cpp
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/CodeGen/SelectionDAG/LegalizeTypes.h
  lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
  lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  lib/Target/AMDGPU/AMDGPUISelLowering.h
  lib/Target/AMDGPU/AMDGPUInstrInfo.td
  lib/Target/AMDGPU/SIInstructions.td
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/Hexagon/HexagonISelLowering.cpp
  lib/Target/Mips/MipsISelLowering.cpp
  lib/Target/PowerPC/PPCISelLowering.cpp
  lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/CodeGen/AMDGPU/llvm.AMDGPU.ldexp.ll
  test/CodeGen/AMDGPU/llvm.ldexp.ll
  test/CodeGen/X86/ldexp.ll
  test/Transforms/InstCombine/exp2-1.ll
  test/Transforms/InstSimplify/floating-point-compare.ll
  test/Transforms/SLPVectorizer/X86/intrinsic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14327.39403.patch
Type: text/x-patch
Size: 46044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151105/446d3a47/attachment-0001.bin>


More information about the llvm-commits mailing list