]> granicus.if.org Git - llvm/commit
[NVPTX] Fix the codegen for llvm.round.
authorBixia Zheng <bixia@google.com>
Mon, 1 Apr 2019 16:10:26 +0000 (16:10 +0000)
committerBixia Zheng <bixia@google.com>
Mon, 1 Apr 2019 16:10:26 +0000 (16:10 +0000)
commit627d3461481261f2806160f7d2a24c5c8524d312
tree95101afed5c6bcf292187ce5b08301477fad0c74
parent071b5c0eb53daa76a84639f0ede5aa5c6baa2090
[NVPTX] Fix the codegen for llvm.round.

Summary:
Previously, we translate llvm.round to PTX cvt.rni, which rounds to the
even interger when the source is equidistant between two integers. This
is not correct as llvm.round should round away from zero. This change
replaces llvm.round with a round away from zero implementation through
target specific custom lowering.

Modify a few affected tests to not check for cvt.rni. Instead, we check
for the use of a few constants used in implementing round. We are also
adding CUDA runnable tests to check for the values produced by
llvm.round to test-suites/External/CUDA.

Reviewers: tra

Subscribers: jholewinski, sanjoy, jlebar, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357407 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXISelLowering.cpp
lib/Target/NVPTX/NVPTXISelLowering.h
lib/Target/NVPTX/NVPTXInstrInfo.td
test/CodeGen/NVPTX/f16-instructions.ll
test/CodeGen/NVPTX/f16x2-instructions.ll
test/CodeGen/NVPTX/math-intrins.ll