[PATCH] D27028: Add intrinsics for constrained floating point operations

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 17:32:57 PST 2016


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: mehdi_amini, aemerson, DavidKreitzer, hfinkel.
andrew.w.kaylor added a subscriber: llvm-commits.
andrew.w.kaylor set the repository for this revision to rL LLVM.

This adds intrinsics that can be used to constrain optimizations that assume the default rounding mode and ignore FP exceptions.

I am starting with a simple lowering that translates the intrinsics directly to the corresponding target-independent FP operations when the selection DAG is built.  I think this is necessary because the existing target-specific pattern matching for FP operations is fairly complex and I think attempting to duplicate all of that infrastructure is likely to result in errors and will certainly result in more work each time new wrinkles are introduced in the future.

I intend to model the implicit uses and defs of FP control and status registers in a future revision, which should be sufficient to prevent unwanted optimizations at the MachineInstr level.  There is also a potential for incorrect code motion in during instruction selection.  My tentative plan to handle that is to introduce pseudo-instruction nodes that wrap the inputs and outputs of the FP operations created based on the new intrinsics and effectively model the implicit FP control and status register behavior and use a chain.  These nodes would then be eliminated during instruction selection.

I believe that this patch is sufficient as presented here and can be committed without any solution to the potential problems with code motion at the ISel and MachineInstr levels.


Repository:
  rL LLVM

https://reviews.llvm.org/D27028

Files:
  docs/LangRef.rst
  include/llvm/CodeGen/SelectionDAGNodes.h
  include/llvm/IR/IntrinsicInst.h
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  lib/IR/IntrinsicInst.cpp
  lib/IR/Verifier.cpp
  test/CodeGen/X86/fp-intrinsics.ll
  test/Feature/fp-intrinsics.ll
  test/Verifier/fp-intrinsics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27028.79005.patch
Type: text/x-patch
Size: 40775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161123/c6b757e8/attachment-0001.bin>


More information about the llvm-commits mailing list