OSDN Git Service

[NVPTX] Implement NVPTXTargetLowering::getSqrtEstimate.
authorJustin Lebar <jlebar@google.com>
Tue, 31 Jan 2017 05:58:22 +0000 (05:58 +0000)
committerJustin Lebar <jlebar@google.com>
Tue, 31 Jan 2017 05:58:22 +0000 (05:58 +0000)
commit6731e5394b0173ec684f3118537428d4965aafff
tree199a97c1b5b1dfc199ccfbd23e45bb4df9935028
parent374362d92036c3f80e17bcc5051b5451498b350a
[NVPTX] Implement NVPTXTargetLowering::getSqrtEstimate.

Summary:

This lets us lower to sqrt.approx and rsqrt.approx under more
circumstances.

* Now we emit sqrt.approx and rsqrt.approx for calls to @llvm.sqrt.f32,
  when fast-math is enabled.  Previously, we only would emit it for
  calls to @llvm.nvvm.sqrt.f.  (With this patch we no longer emit
  sqrt.approx for calls to @llvm.nvvm.sqrt.f; we rely on intcombine to
  simplify llvm.nvvm.sqrt.f into llvm.sqrt.f32.)

* Now we emit the ftz version of rsqrt.approx when ftz is enabled.
  Previously, we only emitted rsqrt.approx when ftz was disabled.

Reviewers: hfinkel

Subscribers: llvm-commits, tra, jholewinski

Differential Revision: https://reviews.llvm.org/D28508

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293605 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXISelLowering.cpp
lib/Target/NVPTX/NVPTXISelLowering.h
lib/Target/NVPTX/NVPTXInstrInfo.td
test/CodeGen/NVPTX/fast-math.ll
test/CodeGen/NVPTX/rsqrt.ll [deleted file]
test/CodeGen/NVPTX/sqrt-approx.ll [new file with mode: 0644]